SA-MP Forums Archive
Pendulum bob rotation (physics problem) - 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: Pendulum bob rotation (physics problem) (/showthread.php?tid=604815)



Pendulum bob rotation (physics problem) - adri1 - 10.04.2016

I got to rotate, but do not think it's an efficient way (see code below) here I show you a video of what I want to accomplish. You can see how at times the object have bad rotations, will understand when you see the code.

http://www.llewellyn.com/blog/wp-con...7/Pendulum.jpg

[ame="http://www.youtube.com/watch?v=BSvaQl4nkec"]http://www.youtube.com/watch?v=BSvaQl4nkec[/ame]

Rotation update code:
http://pastebin.com/0bbGMf3i

All code:
http://pastebin.com/3DbS763v


Respuesta: Pendulum bob rotation (physics problem) - adri1 - 10.04.2016

bump


Re: Pendulum bob rotation (physics problem) - Pottus - 10.04.2016

That is because the position of the objects for the client is not the same for the server. When you SetObjectPos() this is snapping the object for the client to the expected position but you absolutely need to use SetObjectPos() for sync purposes.


Respuesta: Re: Pendulum bob rotation (physics problem) - adri1 - 10.04.2016

Quote:
Originally Posted by Pottus
Посмотреть сообщение
That is because the position of the objects for the client is not the same for the server. When you SetObjectPos() this is snapping the object for the client to the expected position but you absolutely need to use SetObjectPos() for sync purposes.
That's not the problem, the problem is in the object rotation, see:
Код:
SetObjectRot(MOVEBASE, -angle, 0.0, 0.0); //Pendulum angle
EDIT_OBJECT_RotateZ(MOVEBASE, RZ); //This is for rotateZ bob, function from UniversalObjectEditor by Stylock
I want rotate object like this

but not by the method previously shown, because first set angle rotationX of the pendulum and after rotate rotation Z with a function by stylock, it will look bad.


Respuesta: Pendulum bob rotation (physics problem) - adri1 - 13.04.2016

bump


Re: Pendulum bob rotation (physics problem) - codectile - 13.04.2016

Try using
Код:
SetTimer("Update", 30, 1);



Respuesta: Re: Pendulum bob rotation (physics problem) - adri1 - 13.04.2016

Quote:
Originally Posted by codectile
Посмотреть сообщение
Try using
Код:
SetTimer("Update", 30, 1);
That's not the problem