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