SetPosition
From MaratisWiki
(Difference between revisions)
Dahnielson (Talk | contribs) |
Dahnielson (Talk | contribs) m |
||
(3 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | {{lua-function|setPosition|object, vector}} | ||
+ | |||
Set an object to a given position. | Set an object to a given position. | ||
− | Example 1 : This script will move an object to another object. | + | {{lua-function-param|object|object to operate on}} |
− | getPosition is used to determinate the first object (the target) position. | + | {{lua-function-param|vector|vector}} |
+ | |||
+ | '''Example 1:''' This script will move an object to another object. <code>getPosition</code> is used to determinate the first object (the target) position. | ||
object = getObject("object") | object = getObject("object") | ||
Line 13: | Line 17: | ||
[[Category:Lua scripting]] | [[Category:Lua scripting]] | ||
+ | [[Category:Lua function]] | ||
+ | [[Category:Transformation]] |
Latest revision as of 00:18, 9 February 2014
setPosition(object, vector)
Set an object to a given position.
-
object
: object to operate on -
vector
: vector
Example 1: This script will move an object to another object. getPosition
is used to determinate the first object (the target) position.
object = getObject("object") object2 = getObject("object2") -- Scene update function onSceneUpdate() objectpos = getPosition(object) if isKeyPressed("SPACE") then setPosition(object2, {objectpos[1], objectpos[2], objectpos[3]}) end end