SetRotation
(Difference between revisions)
Dahnielson (Talk | contribs) m |
Dahnielson (Talk | contribs) m |
||
| Line 1: | Line 1: | ||
| − | {{lua-function| | + | {{lua-function|setRotation|object, vector}} |
Set an object to a given rotation. | Set an object to a given rotation. | ||
Revision as of 17:52, 8 February 2014
setRotation(object, vector)
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) 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