Hello there
I have been away soooo long from Leadwerk, but intends to start again.
This time I'm trying to use LUA for testing things (C++ will be used more later on).
Anyway. I have the same model exported to 3 separate fbx files with a unique animation in each of them (idle, walk and run).
Each of them looks and animates OK when dragged into the scene. I then dragged the idle fbx to the
scene and attached a script to load the animations and toggle between them. Whooo that came out weird!
Here is the script I have attached to the guy out on the left side in the attached video
function Script:Start()
self.idle = self.entity:LoadAnimation("Models/Characters/eric/eric_idle.mdl")
self.walk = self.entity:LoadAnimation("Models/Characters/eric/eric_walk.mdl")
self.run = self.entity:LoadAnimation("Models/Characters/eric/eric_run.mdl")
self.cur = self.idle
end
function Script:UpdateWorld()
local window = Window:GetCurrent()
if window:KeyHit(Key.Space) then
if self.cur == self.idle then
self.cur = self.walk
elseif self.cur == self.walk then
self.cur = self.run
elseif self.cur == self.run then
self.cur = self.idle
end
end
self.entity:SetAnimationFrame(Time:GetCurrent()/30.0,1,self.cur,true)
end
Is this code a wrong or is the problem somewhere else?
Any suggestions?
Here is a video showing the problem
http://northwerk.com/videos/le2.mp4