how to move object like this? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to move object like this? (
/showthread.php?tid=489021)
how to move object like this? -
newbienoob - 20.01.2014
Let's say I want to throw an object, like ball for example. But I need to move the object like this;
I think it requires some math tricks. I suck in math, so..
Anyway, does anyone know how to do that?
Re: how to move object like this? -
MP2 - 20.01.2014
MoveObject works in a straight line, so you'd have to do something like this:
Or you could rapidly SetObjectPos along the line.
Re: how to move object like this? -
newbienoob - 20.01.2014
There must be another way. I mean, like when player throws a grenade, the grenade smoothly moves in the air and hit the ground. If that was possible in gtasa, why not in sa-mp?
Also, I've seen in some sa-mp cod server where there was a grenade launcher(on m4). It smoothly launches a grenade like the real grenade launcher.
Re: how to move object like this? -
Riddick94 - 20.01.2014
Have a look in physics made by PeppeAC. There are 2D and 3D physics, might help you.
Re: how to move object like this? -
iJumbo - 20.01.2014
This is a fs that I did to make you understand how physics work.. might help you better understand how it works instead of looking in the big code recommended by Riddick94
http://pastebin.com/gUbRxbY4
basically you have to joke with this configs
pawn Код:
OBJ[ID][vx] = floatsin(-ang, degrees) * -5.5;
OBJ[ID][vy] = floatcos(-ang, degrees) * -5.5;
OBJ[ID][vz] = -3.5;
OBJ[ID][gravity] = 10.1;
OBJ[ID][bounce_factor] = 40.49;
OBJ[ID][radiuss] = 0.2;
OBJ[ID][friction] = 0.001;
You can find them in the test command
If you don't want mapandreas just set the z cord as you wish and the object will bounce when the object pos is < than z cord