GetObjectRotation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
Object rotation can be retrieved from objects in mapfiles or objects that are created in scripts. | |||
==Syntax== | ==Syntax== | ||
Line 10: | Line 10: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''Object:''' | *'''Object:''' The object whose rotation will be retrieved | ||
===Returns=== | ===Returns=== | ||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
In this example, I | In this example, I refer to a mapfile object. The object is called "pirateship" in the mapfile. Here is the excerpt from the mapfile: | ||
<object id="pirateship" posX="-1627.319092" posY="128.543411" posZ="6.581001" rotX="-0.760854" rotY="2.421000" rotZ="0.851000" model="8493"/> | <object id="pirateship" posX="-1627.319092" posY="128.543411" posZ="6.581001" rotX="-0.760854" rotY="2.421000" rotZ="0.851000" model="8493"/> |
Revision as of 23:29, 8 September 2006
Object rotation can be retrieved from objects in mapfiles or objects that are created in scripts.
Syntax
float float float getObjectRotation ( element object )
Required Arguments
- Object: The object whose rotation will be retrieved
Returns
Returns true if object exists, false otherwise.
Example
In this example, I refer to a mapfile object. The object is called "pirateship" in the mapfile. Here is the excerpt from the mapfile:
<object id="pirateship" posX="-1627.319092" posY="128.543411" posZ="6.581001" rotX="-0.760854" rotY="2.421000" rotZ="0.851000" model="8493"/>
root = getRootElement () addEventHandler ( "onMapLoad", root, "onMapLoad" ) function onMapLoad ( name, root ) pirateship = getElementByID ( "pirateship" ) if ( pirateship == false ) then outputChatBox ( "couldn't find the ship!" ) end rx, ry, rz = getObjectRotation ( pirateship ) outputChatBox ( "Ship RX = "..rx.." SHIP RY = "..ry.." SHIP RZ = "..rz ) end
Result in chatbox: Ship RX = 316.40628051758 SHIP RY = 2.421000 SHIP RZ = 0.851000
See Also