How to use rotation in MoveObject (0.3d) -
MP2 - 06.11.2011
MoveObject Rotation
by Mike
Introduction
I'm quite surprised nobody has made a tutorial on this yet!
Arguably the best feature in SA:MP 0.3d is; smooth object rotation. While it could be thought easy to implement, unless you know how it can be extremely confusing.
Function
First of all, let's take a look at the new parameters
MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed,
Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0);
RotX, RotY and RotZ were added in 0.3d RC2.
The most important thing you need to know is that the rotation parameters are the FINAL ROTATION; meaning they are the rotation the object will be at when it stops moving. Thus, in order to achieve rotation you MUST move the object. Let's look at how to do that.
Usage
pawn Код:
// Create the object at the center of San Andreas [just used for example]
new eg_obj = CreateObject(1234, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
// Rotate the object by 180 degrees on the z axis
MoveObject(eg_obj, 0, 0, 3+0.0001, 0.0001, 0.0, 0.0, 180.0);
That code will move the object up by 0.0001 units (not even noticable) at a speed of 0.0001. It will take one second to complete, as the Z difference and speed are the same value, and the speed is in units per second. Here is a video of the above code in action:
[ame]http://www.youtube.com/watch?v=76MIkBZOyT0[/ame]
If you wish to make a barrier that opens and closes, when opening the barrier add 0.0001 to the Z height, and SUBTRACT 0.0001 when closing it. If you add 0.0001 each time it opens and closes, it's going to keep going up and up.
Summary
Thanks for reading. If you have any suggestions for improvements or additions to this tutorial please do let me know.
Re: How to use rotation in MoveObject (0.3d) -
Mr_Scripter - 07.11.2011
Great work
Re: How to use rotation in MoveObject (0.3d) -
System64 - 07.11.2011
nice one
Good job
Re: How to use rotation in MoveObject (0.3d) -
MP2 - 19.11.2011
Thanks for the comments. Perhaps this will be of more use when 0.3d is released.
Re: How to use rotation in MoveObject (0.3d) - Astralis - 19.11.2011
Thanks for this tutorial. Will be useful in future.
Re: How to use rotation in MoveObject (0.3d) -
xinix000 - 23.11.2011
What about streamed object ?
Re: How to use rotation in MoveObject (0.3d) -
thimo - 06.12.2011
So this works for the orange-blue barrier?
Re: How to use rotation in MoveObject (0.3d) -
Michael@Belgium - 06.12.2011
Quote:
The most important thing you need to know is that the rotation parameters are the FINAL ROTATION; meaning they are the rotation the object will be at when it stops moving
|
Oh that's why it doesn't work ...
Thanks for the tut
Re: How to use rotation in MoveObject (0.3d) -
xNn - 06.12.2011
Thank you, i needed that.
Re: How to use rotation in MoveObject (0.3d) -
GangsTa_ - 06.03.2012
Quote:
Originally Posted by thimo
So this works for the orange-blue barrier?
|
Same question, it works?