Translate
(Difference between revisions)
Dahnielson (Talk | contribs) |
Dahnielson (Talk | contribs) |
||
Line 21: | Line 21: | ||
[[Category:Lua scripting]] | [[Category:Lua scripting]] | ||
[[Category:Lua function]] | [[Category:Lua function]] | ||
− | [[Category: | + | [[Category:Transformation]] |
Revision as of 14:29, 5 February 2014
Simply Translate the object in 3d space, the 3 zeros are X,Y,Z values.
The "local" argument is optional (local coordinates), without it the transformation is global (global coordinates).
Example 1 Continuous translation :
object = getObject("object") -- Scene update function onSceneUpdate() translate(object, {0, 0, 1}, "local") end
Example 2 : Translate on key press (Space)
object = getObject("object") -- Scene update function onSceneUpdate() if isKeyPressed("SPACE") then translate(object, {0, 0, 1}, "local") end end