GetPosition
(Difference between revisions)
m |
Dahnielson (Talk | contribs) |
||
| Line 22: | Line 22: | ||
See setPosition(object) func. for a more advanced usage [[http://wiki.maratis3d.org/index.php?title=SetPosition]] | See setPosition(object) func. for a more advanced usage [[http://wiki.maratis3d.org/index.php?title=SetPosition]] | ||
| + | |||
| + | [[Category:Lua scripting]] | ||
Revision as of 18:00, 4 February 2014
Get the current object position in 3d space.
objectpos = getPosition(object)
Then you can use your object coordinates like this :
objectpos[1] : X position
objectpos[2] : Y position
objectpos[3] : Z position
Example 1, Press Space to display the X position of the object in maratis console window :
object = getObject("object")
-- Scene update
function onSceneUpdate()
objectpos = getPosition(object) -- you can rename objectpos whatever you want
if isKeyPressed("SPACE") then print(objectpos[1]) end
end
See setPosition(object) func. for a more advanced usage [[1]]