SetScale

From MaratisWiki
(Difference between revisions)
Jump to: navigation, search
m
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{lua-function|setScale|object, vector}}
 +
 
Modify the size of an object.
 
Modify the size of an object.
  
Example 1 : Simple usage
+
{{lua-function-param|object|object to operate on}}
 +
{{lua-function-param|vector|vector}}
 +
 
 +
'''Example 1:''' Simple usage
  
 
     object = getObject("object")
 
     object = getObject("object")
Line 8: Line 13:
 
     end
 
     end
  
Example 2 : Continuous scaling with [[GetScale|getScale]]
+
'''Example 2:''' Continuous scaling with [[GetScale|getScale]]
  
 
     object = getObject("object")
 
     object = getObject("object")
Line 18: Line 23:
  
 
[[Category:Lua scripting]]
 
[[Category:Lua scripting]]
 +
[[Category:Lua function]]
 +
[[Category:Transformation]]

Latest revision as of 01:19, 9 February 2014

setScale(object, vector)

Modify the size of an object.

  • object : object to operate on
  • vector : vector

Example 1: Simple usage

   object = getObject("object")
   function onSceneUpdate()
       if isKeyPressed("SPACE") then setScale(object, {1, 1, 5}) end -- change object Z scale to 5
   end

Example 2: Continuous scaling with getScale

   object = getObject("object")
   function onSceneUpdate()
       SCL = getScale(object)
       if isKeyPressed("UP") then setScale(object, {1, 1, SCL[3]+1}) end -- Increase Z scale continuously
       if isKeyPressed("DOWN") then setScale(object, {1, 1, SCL[3]-1}) end -- Decrease Z scale continuously
   end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox