GetPosition

From MaratisWiki
Revision as of 01:18, 9 February 2014 by Dahnielson (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

getPosition(object)

Get the current object position in 3d space.

  • object : object to operate on
 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) function for a more advanced usage.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox