Virtual Line linking 2 objects
#8

Similar although didn't test that
pawn Код:
stock IsBetweenXYZ(Float: X, Float: Y, Float: Z, Float: X1, Float: Y1, Float: Z1, Float: X2, Float: Y2, Float: Z2, Float: deg = 5.0) {
    new
        Float: rZ = atan((Z2 - Z1) / VectorSize(X2 - X1, Y2 - Y1, 0.0))
    ;
    return (
        (-deg <= (atan2(X2 - X1, Y2 - Y1) - atan2(X - X1, Y - Y1)) <= deg) &&
        (-deg <= (atan2(X1 - X2, Y1 - Y2) - atan2(X - X2, Y - Y2)) <= deg) &&
        (-deg <= (rZ - atan((Z - Z1) / VectorSize(X - X1, Y - Y1, 0.0))) <= deg) &&
        (-deg <= (rZ + atan((Z - Z2) / VectorSize(X - X2, Y - Y2, 0.0))) <= deg)
    );
}
Reply


Messages In This Thread
Virtual Line linking 2 objects - by Battlezone - 26.03.2015, 13:16
Re: Virtual Line linking 2 objects - by fuckingcruse - 26.03.2015, 14:47
Re: Virtual Line linking 2 objects - by JaydenJason - 26.03.2015, 15:23
Re: Virtual Line linking 2 objects - by Pottus - 26.03.2015, 15:44
Re: Virtual Line linking 2 objects - by Battlezone - 26.03.2015, 16:33
AW: Virtual Line linking 2 objects - by Nero_3D - 26.03.2015, 17:38
Re: Virtual Line linking 2 objects - by Pottus - 26.03.2015, 17:44
AW: Virtual Line linking 2 objects - by Nero_3D - 26.03.2015, 19:34
Re: Virtual Line linking 2 objects - by Battlezone - 26.03.2015, 20:02
Re: Virtual Line linking 2 objects - by Pottus - 26.03.2015, 20:25

Forum Jump:


Users browsing this thread: 1 Guest(s)