FoxMulder Posted January 2, 2015 Share Posted January 2, 2015 Hello everyone, I'm a newcomer to Lua and Leadwerks. I have imported a premade animated model into Leadwerks in FBX format. It works perfectly however I can't find any reference about activate animations through LUA scripting. E.g. I would like to make a character walking forward on W KeyHit. All tutorials I've found till now are about C++.. Can anyone help me? Quote Link to comment Share on other sites More sharing options...
nick.ace Posted January 2, 2015 Share Posted January 2, 2015 I think you are a little confused between animation and character controller movement. Animation is the movement of bones where are controller movement is the character actually moving somewhere. They are independent of each other. Controller movement is controlled with this command: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetinput-r706 The FPSPlayer.lua file shows pretty well how to do the controller movement. Animation is controlled with this command: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetanimationframe-r141 Animation is generally pretty simple in that you just set a frame (i.e. use Time:Millisecs() or something to change the frame) and pick and animation. Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 2, 2015 Author Share Posted January 2, 2015 Thank you Nick Ace ! Well I knew they are completely different but I wanted to know if there's a function to activate SetAnimationFrame when I use a certain input. This is my question Quote Link to comment Share on other sites More sharing options...
nick.ace Posted January 2, 2015 Share Posted January 2, 2015 Oh ok. Did I answer your question, though? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 2, 2015 Share Posted January 2, 2015 The C++ tutorials also have a lua script version. An overview of the lins can be found here: http://leadwerks.wikidot.com/wiki:tutorials 1 Quote Link to comment Share on other sites More sharing options...
nick.ace Posted January 2, 2015 Share Posted January 2, 2015 I wish Josh would place a link to the wiki under the Community tab. It's sort of hidden from everyone, but it has a bunch of useful stuff. Quote Link to comment Share on other sites More sharing options...
marchingcubes Posted January 2, 2015 Share Posted January 2, 2015 Hi, I have a character with a set of animations, and my controller's animation section uses the Animation Controller Script. this lets you have a set of looped animations, anf pretty much 'just works' for walk cycles etc. You will need to change speed/blend to match you animations rate. http://www.leadwerks.com/werkspace/page/documentation/_/script-reference/animationmanager-r693 it looks like: function Script:UpdateWorld() if self.parentEntity.script.isAttacking == true then self.baseAnimMgr:SetAnimationSequence(self.AnimAttack, 0.05, 200) else if self.parentEntity.script.playerMovement.z ~=0 or self.parentEntity.script.playerMovement.x ~=0 then if self.parentEntity.script.enteredWater == true then self.baseAnimMgr:SetAnimationSequence(self.AnimSwim, 0.05, 200) else self.baseAnimMgr:SetAnimationSequence(self.AnimWalk, 0.05, 200) end else self.baseAnimMgr:SetAnimationSequence(self.AnimIdle, 0.005, 200) end end Hope that helps Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 2, 2015 Author Share Posted January 2, 2015 Thank you very much guys ! I'll try and I will let you know ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.