GetObjectRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 16: Line 16:


==Example==  
==Example==  
This example does...
In this example, I'm referring to "pirateship", an object in a map file. Here is the mapfile line:
 
<object id="pirateship" posX="-1627.319092" posY="128.543411" posZ="6.581001" rotX="-0.760854" rotY="2.421000" rotZ="0.851000" model="8493"/>
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
root = getRootElement ()
blabhalbalhb --abababa
 
--This line does this...
addEventHandler ( "onMapLoad", root, "onMapLoad" )
mooo
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
</syntaxhighlight>
</syntaxhighlight>
Result in chatbox:
Ship RX = 316.40628051758 SHIP RY = 2.421000 SHIP RZ = 0.851000


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{FunctionArea_Functions}}

Revision as of 23:24, 8 September 2006


This fake function is for use with blah & blah and does blahblahblabhalbhl

Syntax

float float float getObjectRotation ( element object )       

Required Arguments

  • Object: This object can be created in the script or already exist in a mapfile

Returns

Returns true if object exists, false otherwise.

Example

In this example, I'm referring to "pirateship", an object in a map file. Here is the mapfile line:

<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

Template:FunctionArea Functions