ChangeAnimation

From MaratisWiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Play or Change an Animation Note that it also apply to looped animations. Basic use : object = getObject("object") function onSceneUpdate() -- On "W" Key...")
 
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Play or Change an Animation
+
{{lua-function|changeAnimation|object, animationId}}
+
Note that it also apply to looped animations.
+
  
 +
Play or change an animation. Note that it also apply to looped animations.
  
 
+
{{lua-function-param|object|object to operate on}}
Basic use :
+
{{lua-function-param|animationId|animation to change to}}
  
 
     object = getObject("object")
 
     object = getObject("object")
Line 12: Line 11:
 
         if isKeyPressed("W")  then
 
         if isKeyPressed("W")  then
 
             -- Play Walk Animtion
 
             -- Play Walk Animtion
             changeAnimation(Player, "1")
+
             changeAnimation(object, "1")
 
         end
 
         end
 
         -- On "W" Key Release
 
         -- On "W" Key Release
 
         if onKeyUp("W") then
 
         if onKeyUp("W") then
 
             -- Change to Pose
 
             -- Change to Pose
             changeAnimation(Player, "0")
+
             changeAnimation(object, "0")
 
         end  
 
         end  
 
     end
 
     end
 +
 +
[[Category:Lua scripting]]
 +
[[Category:Lua function]]
 +
[[Category:Animation]]

Latest revision as of 00:58, 9 February 2014

changeAnimation(object, animationId)

Play or change an animation. Note that it also apply to looped animations.

  • object : object to operate on
  • animationId : animation to change to
   object = getObject("object")
   function onSceneUpdate()
       -- On "W" Key Press
       if isKeyPressed("W")  then
           -- Play Walk Animtion
           changeAnimation(object, "1")
       end
       -- On "W" Key Release
       if onKeyUp("W") then
           -- Change to Pose
           changeAnimation(object, "0")
       end 
   end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox