GetBallisticCurvePos By Mauzen
#1

pawn Код:
/*
    Calculates position and rotation of a ballistic object
    being fired after the given amount of milliseconds

    All parameters except 'millis' have to be the initial values when the
    projectile is fired. They will be transformed to the values after 'millis' milliseconds

    x/yvector is the directional factor in x/y direction (e.g. sin/cos of players rotation)
*/

GetBallisticCurvePos(&Float:x, &Float:y, &Float:z, Float:xvector, Float:yvector, &Float:angle, &Float:speed, Float:millis)
{
    new Float:xo = speed * floatcos(angle, degrees) * millis;

    x = x + xo * xvector;
    y = y + xo * yvector;
    z = z + ((GRAVITATION / -2.0) * millis * millis + speed * floatsin(angle, degrees) * millis);

    //if(GetGroundZ(x, y) < z) return false;

    //speed = floatsqroot( speed * speed - 2 * speed * GRAVITATION * millis * floatsin(angle, degrees) + GRAVITATION * GRAVITATION * millis * millis );

    //speed = floatsqroot( speed * speed + GRAVITATION * GRAVITATION * millis * millis );
    return true;
}
That was posted by mauzen in the past and i don't know what is that angle
As He said
Float:GRAVITATION = 9.81;
x y z of the object
speed of the movement
milli seconds
angle ??
Xvector = sin(a);
yvector = cos(a);

i am making a grenade launcher
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)