SA-MP Forums Archive
Smooth moving gate (Object) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Smooth moving gate (Object) (/showthread.php?tid=274058)



Smooth moving gate (Object) - sim_sima - 04.08.2011

Hi guys.
I made a moving gate (object) using Incognito's streamer.
My problem is making the movement smooth in stead of this:



I know that there is a MoveDynamicbject function, but it also has to rotate.
I have seen gates in other servers with smooth movements, so i know its possible.

Hope you can help. Thanks.


Re: Smooth moving gate (Object) - Famalamalam - 04.08.2011

Why does it have to rotate as well?


Re: Smooth moving gate (Object) - sim_sima - 04.08.2011

Quote:
Originally Posted by Famalamalam
Посмотреть сообщение
Why does it have to rotate as well?
Because it has to rise up, like in real life. You know, object rotation


Re: Smooth moving gate (Object) - sim_sima - 04.08.2011

It doesnt work when i use MoveDynamicObject


Re: Smooth moving gate (Object) - Famalamalam - 04.08.2011

You should make your point more clear...

Quote:

I know that there is a MoveDynamicbject function, but it also has to rotate.

ALSO has to rotate.

Are you creating the object with CreateDynamicObject? Are you using IsValidDynamicObject to check?


Re: Smooth moving gate (Object) - sim_sima - 05.08.2011

Yes, i used CreateDynamicObject to create the object. If you look at the animaated image, it shows how it looks right now when the gate opens. I want to make it more realistic, like open slowly and smooth in stead of jumping from one point to another. The MoveDynamicObject wont do the trick, because the object also has to rotate in order to be in open position.


Re: Smooth moving gate (Object) - iPLEOMAX - 05.08.2011

You have to use TWO functions at the SAME TIME:

pawn Код:
1. MoveDynamicObject() //Normally
2. SetDynamicObjectRot() //Using a repeating timer...
Key1: Object is closed
Key2: Object is opened.

So, to do the animation correctly:
-> Move the object Higher and closer to the Joint.
-> Using a timer rotate the object at a total of 90 degrees in X/Y axis (depending on your world postion).

Let me show you a picture:



Re: Smooth moving gate (Object) - sim_sima - 05.08.2011

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
You have to use TWO functions at the SAME TIME:

pawn Код:
1. MoveDynamicObject() //Normally
2. SetDynamicObjectRot() //Using a repeating timer...
Key1: Object is closed
Key2: Object is opened.

So, to do the animation correctly:
-> Move the object Higher and closer to the Joint.
-> Using a timer rotate the object at a total of 90 degrees in X/Y axis (depending on your world postion).

Let me show you a picture:
Wow. Thank you very much.
I also thought about using a timer, but i was wondering wheter there was an easier way or not.
Now i know that there is not
But where exactely should I use the timer?

Thank you very much!


Re: Smooth moving gate (Object) - iPLEOMAX - 05.08.2011

Use the timer to increase the angle value to maximum of 90.

Example (in words): Set Repeating Timer on Objectid's Y Angle +10.

When it reaches/over 90. Kill the timer.

So it should animate like it's Swinging, I hope you understand.

BTW, I'm creating an Object Mover Tool Now, will release it soon.


Re: Smooth moving gate (Object) - Michael@Belgium - 05.08.2011

Maybe you can use an include... Object Rotation include (like this one)
I use the same in my Filterscript ^^


Re: Smooth moving gate (Object) - sim_sima - 05.08.2011

Thanks everyone. I have it now