SA-MP Forums [Tutorial] Axis and Angles/rotation of attached Objects
 New Account Members List Search Today's Posts Mark Forums Read

 09/03/2011, 06:17 PM #1 bhaveshnande Big Clucker     Join Date: Dec 2010 Location: India Posts: 111 Reputation: 21 Axis and Angles/rotation of attached Objects In this tutorial I will try to explain the X, Y and Z coordinate system that SAMP uses for its attached objects, also I will cover the coordinates and angles which you need while attaching object to a player. ContentsPlayer attached object coordinates Player attached object angles Map coordinates Player Attached Object Coordinates I've seen many people in the scripting discussion section asking about how to set values in SetPlayerAttachedObject, so this tutorial would explain it to them. Without wasting much time lets start. So SetPlayerAttachedObject needs offset to be set for objects to be attached at the right position, it has foffsetX, foffsetY and foffsetZ. Offset decides distance of the object from center of the bone which you select. foffsetX : Distance of Object on X axis from center of bone foffsetY : Distance of Object on Y axis from center of bone foffsetZ : Distance of Object on Z axis from center of bone Now lets understand which one is X, Y and Z axis. I'll use a money bag example here, money bag has ID:1550 If you just attach the money bag to spine(bone) without any other tweaks it gets attached like this SetPlayerAttachedObject(playerid, 1, 1550, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1); Now we need to adjust its position. If you try setting foffsetX to 1, the object moves along X axis above the player, this means X axis is the vertical line in SAMP. SetPlayerAttachedObject(playerid, 1, 1550, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1); Similarly you can try with Y and Z axis. We've found that X axis is the vertical axis, Y axis is the horizontal axis going through the player from his front to the back and Z axis goes horizontal through the player from left to right. X, Y and Z axis of a player are shown below using ****** Sketchup. This picture clearly shows the X, Y and Z axis of a player object, also the +ve and -ve directions are shown. Player Attached Objects Angles Now we will learn about the angles, you need to set them for every axis to turn or to rotate the object as you want. We have 3 values fRotX : Rotation about X axis fRotY : Rotation about Y axis fRotZ : Rotation about Z axis Lets try inserting 90° in place of fRotX SetPlayerAttachedObject(playerid, 1, 1550, 1, 0, 0, 0, 90, 0, 0, 1, 1, 1); That will give you something like this. Now try changing it to 180°, it will turns the object exactly upside down. In the picture below i've shown the degrees of rotation along X axis. The original position at which the object spawns when you keep the fRotX field blank is 0 degrees. If you change it to 90°, it will rotate backwards and so on. You can even insert negative values here. Its similar to the geometry that you all have learnt in your schools, the maximum value here is 360 degrees. You can try yourself the same rotation changes for Y and Z axis. Here are the rotation degrees for Y axis: And Z axis: Note : You need to set the fScaleX, fScaleY and fScaleZ values greater than 0, if you keep these values zero the object will become invisible. Settings the values of fScaleX, fScaleY and fScaleZ to 1 keeps the size of object original. You can change this value to any integer you like. Map Coordinates Well here's a small tip about map coordinates. Apart from player attached object axis the map axis are different. X axis on the map refers the east and west directions while Y axis denote north-south directions. Z axis is for height. Thats all for now! It was my first tutorial so correct me if I am wrong somewhere __________________ First they ignore you, Then they laugh at you, Then they fight you, Then you win. - Mohandas Karamchand Gandhi. [Tutorial] Axis and Angles/rotations of Attached Objects [Tool/Web/Other] BSN Textdraw Editor Online [Tool/Web/Other] BSN Image2Textdraw Converter Online Last edited by bhaveshnande; 10/03/2011 at 07:27 AM.
 09/03/2011, 06:19 PM #2 sleepysnowflake Gangsta     Join Date: Dec 2009 Posts: 982 Reputation: 138 Re: Axis and Angles/rotation of attached Objects Amazing! Thank you ! :O
 09/03/2011, 06:19 PM #3 Stigg High-roller     Join Date: Aug 2010 Location: Other side of the Universe. Posts: 2,044 Reputation: 125 Re: Axis and Angles/rotation of attached Objects Now thats what i call a tutorial. Great work. 11/10 You can't ask for more. __________________ Peace...
 09/03/2011, 06:19 PM #4 Medal Of Honor team Gangsta     Join Date: Feb 2011 Location: Osama Bin Laden's house ;) Posts: 538 Reputation: 2 Re: Axis and Angles/rotation of attached Objects Very nice one!!! __________________ Making a Social Website from scratch. Need a PHP partner
 09/03/2011, 06:37 PM #5 CyNiC High-roller   Join Date: Jan 2009 Location: Brazil Posts: 1,433 Reputation: 203 Re: Axis and Angles/rotation of attached Objects Very useful, it can help many people that don't understand about theses positions. __________________ My scripts Brazucas'Server
 10/03/2011, 06:39 AM #6 XFlawless Guest   Posts: n/a Re: Axis and Angles/rotation of attached Objects Very useful for setting Camera positions...etc.
 10/03/2011, 06:48 AM #7 bhaveshnande Big Clucker     Join Date: Dec 2010 Location: India Posts: 111 Reputation: 21 Re: Axis and Angles/rotation of attached Objects Thank u all for sweet comments :P __________________ First they ignore you, Then they laugh at you, Then they fight you, Then you win. - Mohandas Karamchand Gandhi. [Tutorial] Axis and Angles/rotations of Attached Objects [Tool/Web/Other] BSN Textdraw Editor Online [Tool/Web/Other] BSN Image2Textdraw Converter Online
 10/03/2011, 07:19 AM #8 black_dota Big Clucker   Join Date: Jul 2010 Posts: 143 Reputation: 1 Re: Axis and Angles/rotation of attached Objects I like your ****** Sketchup Nice tutorial! pawn Code: `This forum requires that you wait 60 seconds between posts. Please try again in 15 seconds.` Ah... __________________ pawn Code: `public OnPlayerConnect(playerid){    Spam(playerid, 9000, "It's Over 9000 !!!");    return true;}stock Spam(playerid, number_of_times, message[]){    for(new c; c < number_of_times; c++) {        SendClientMessage(playerid, 0x0099CCFF, message);    }    return true;}`
10/03/2011, 07:23 AM   #9
bhaveshnande
Big Clucker

Join Date: Dec 2010
Location: India
Posts: 111
Reputation: 21
Re: Axis and Angles/rotation of attached Objects

Quote:
 I like your ****** Sketchup Nice tutorial!
Ty Well ****** Sketchup was the only way for me to show all the rotation angles And in addition, its Free!
__________________
First they ignore you,
Then they laugh at you,
Then they fight you,
Then you win.

- Mohandas Karamchand Gandhi.

[Tutorial] Axis and Angles/rotations of Attached Objects
[Tool/Web/Other] BSN Textdraw Editor Online
[Tool/Web/Other] BSN Image2Textdraw Converter Online

 13/03/2011, 01:51 PM #10 [SFA]SpiRRiT Big Clucker     Join Date: Dec 2010 Location: The Netherlands Posts: 139 Reputation: 1 Re: Axis and Angles/rotation of attached Objects Awesomee!!

 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

 Similar Threads Thread Thread Starter Forum Replies Last Post GuikBretas Help Archive 1 27/02/2011 01:43 PM jonrb Help Archive 3 02/12/2010 11:53 PM x-cutter Help Archive 5 21/02/2009 01:43 PM

All times are GMT. The time now is 10:29 AM.

 -- (EN) English -- (RU) Русски Contact Us - SA-MP - Archive - Top