GetObjectRotation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
If a player points at an object with a gun, it will output it's rotation to the player. | If a player points at an object with a gun, it will output it's rotation to the player. | ||
<section name="Server" class="server"> | <section name="Server" show="true" class="server"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onPlayerTargeted ( element ) | function onPlayerTargeted ( element ) |
Revision as of 22:19, 4 August 2007
Object rotation can be retrieved from objects in mapfiles or objects that are created in scripts.
Syntax
float float float getObjectRotation ( object theObject )
Required Arguments
- theObject: The object whose rotation will be retrieved
Returns
Returns three float if object exists, false in the first variable and nil in the other two if it's invalid.
Example
If a player points at an object with a gun, it will output it's rotation to the player.
Click to collapse [-]
Serverfunction onPlayerTargeted ( element ) if ( isElement(element) and getElementType ( element ) == "object") then local x,y,z = getObjectRotation(element) outputChatBox("Object rotation: "..x.." "..y.." "..z,source) end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )
Click to expand [+]
ClientSee Also