03.01.2018, 09:39
Quote:
Use this:
x0,y0 - start position t - time (1,2,3,4,5..., you can use Float for better results) alpha - angle for shoot v0 - speed of shoot g - gravitation (9.806) x,y - current position for object in time t cyklus for t (time) + caltulate position in time (more times it's better look, but many calculates). I had used for golf engine on my server and works fine. |
PHP код:
stock MoveFire(Float:x, Float:y, Float:z, Float:angle)
{
new Float: tx;
new Float: ty;
new time = 3;
tx = x + 100*time*floatcos(angle);
ty = y + 100*time*floatsin(angle)-1/2*9.806*time*time;
new DynamicObject = CreateDynamicObject(2064, x, y, z, 0.00000, 0.00000, 0.00000);
MoveDynamicObject(DynamicObject, tx, ty, z, 3.0);
return 1;
}
CMD:test(playerid, params[])
{
new Float:x,Float:y,Float:z;
new Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
MoveFire(x, y, z, angle);
return 1;
}