SetRotation

(Difference between revisions)
Jump to: navigation, search
(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...")
 
Line 11: Line 11:
 
         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]]

Revision as of 19:01, 4 February 2014

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
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox