SA-MP Forums [Tutorial] How to use rotation in MoveObject (0.3d)
 New Account Members List Search Today's Posts Mark Forums Read

 06/11/2011, 08:29 PM #1 MP2 Godfather     Join Date: Jan 2011 Location: England Posts: 6,422 Reputation: 973 How to use rotation in MoveObject (0.3d) 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 Code: ```// 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. Last edited by MP2; 31/01/2012 at 06:26 AM.
 07/11/2011, 05:13 PM #2 Mr_Scripter Huge Clucker     Join Date: Mar 2011 Posts: 398 Reputation: 33 Re: How to use rotation in MoveObject (0.3d) Great work __________________ Current Project: Stunt-DM-Drift-Race. Done: 0% Looking for 2Mappers... Pm Me Gamemodes SanAndreas Team DeathMatch Gamemode-4 hours work
 07/11/2011, 05:26 PM #3 System64 Gangsta     Join Date: May 2011 Location: Zadar, Croatia Posts: 940 Reputation: 143 Re: How to use rotation in MoveObject (0.3d) nice one Good job __________________ All my works I left SA:MP! Maybe once I start scripting again but now I'm based on web programming Soon, I'll buy domain system32.com.hr but for now you can contact me on LogoOff or on my Youtube channel!
 19/11/2011, 02:04 AM #4 MP2 Godfather     Join Date: Jan 2011 Location: England Posts: 6,422 Reputation: 973 Re: How to use rotation in MoveObject (0.3d) Thanks for the comments. Perhaps this will be of more use when 0.3d is released.
 19/11/2011, 05:27 PM #5 Astralis High-roller   Join Date: Sep 2009 Location: France Posts: 3,228 Reputation: 448 Re: How to use rotation in MoveObject (0.3d) Thanks for this tutorial. Will be useful in future. __________________ http://samp4you.com - SA-MP Server Hosting Hosted Tab 25€/mo || 50 Slots 3€/mo PaySafeCard/Skrill/PayPal/Bank Accepted! English Support & Anti-DDoS Protected
 23/11/2011, 03:08 AM #6 xinix000 Big Clucker   Join Date: May 2010 Posts: 104 Reputation: 0 Re: How to use rotation in MoveObject (0.3d) What about streamed object ?
 06/12/2011, 03:14 PM #7 thimo High-roller     Join Date: Jan 2009 Location: Netherlands Posts: 1,146 Reputation: 24 Re: How to use rotation in MoveObject (0.3d) So this works for the orange-blue barrier?
06/12/2011, 03:21 PM   #8
Michael@Belgium
High-roller

Join Date: Dec 2010
Location: Belgium
Posts: 3,037
Reputation: 1001
Re: How to use rotation in MoveObject (0.3d)

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
__________________
Interested in a full featured and cheap derby gamemode or need host-tab ? Contact me on skype: michael.belgium

 06/12/2011, 03:43 PM #9 xNn Little Clucker   Join Date: Jul 2009 Posts: 21 Reputation: 0 Re: How to use rotation in MoveObject (0.3d) Thank you, i needed that.
 12/12/2011, 02:14 PM #10 wups High-roller     Join Date: Apr 2010 Location: Lithuania Posts: 1,254 Reputation: 137 Re: How to use rotation in MoveObject (0.3d) Thanks, I find this very useful! __________________ My Releases: Code: ```[Includes] Simple,Fast Anti-Money Hack with FS support Server Sided Weapons OnPlayerShootPlayer v8 OnPlayerVehicleDamage GetPlayerDialogID [FilterScripts] Mechanical Gear System v2 Default Map Icons MySQL E-Mail system [GameModes] Escape from Area 51```

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules