Translate

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
Simply Translate the object in 3d space, the 3 zeros are X,Y,Z values.<br>
+
{{lua-function|translate|object, vector, local}}
''The "local" argument is optional (local coordinates), without it the transformation is global (global coordinates).''
+
  
 +
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 :
+
'''Example 1:''' Continuous translation.
  
 
     object = getObject("object")  
 
     object = getObject("object")  
Line 11: Line 11:
 
     end
 
     end
 
 
Example 2 : Translate on key press (Space)
+
'''Example 2:''' Translate on key press.
  
 
     object = getObject("object")  
 
     object = getObject("object")  

Revision as of 18:39, 8 February 2014

translate(object, vector, local)

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.

   object = getObject("object") 
   -- Scene update
   function onSceneUpdate()	
       if isKeyPressed("SPACE") then translate(object, {0, 0, 1}, "local") end
   end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox