Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Character controller LUA scripting

Recommended Posts

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?

Link to post
Share on other sites

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:


The FPSPlayer.lua file shows pretty well how to do the controller movement.


Animation is controlled with this command:


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.

Link to post
Share on other sites



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.




it looks like:


function Script:UpdateWorld()


if self.parentEntity.script.isAttacking == true then

self.baseAnimMgr:SetAnimationSequence(self.AnimAttack, 0.05, 200)


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)


self.baseAnimMgr:SetAnimationSequence(self.AnimWalk, 0.05, 200)




self.baseAnimMgr:SetAnimationSequence(self.AnimIdle, 0.005, 200)





Hope that helps

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...