psychoanima Posted July 6, 2016 Share Posted July 6, 2016 I have 3 .fbx animation, one is for running, second is idle, third jumping. (2.5d platformer) To trigger running I am using if window:KeyDown(Key.D) then self.entity:SetAnimationFrame() end Problem: how to trigger idle animation since there is no Key release function? And how to blend it with previous animation? Second problem: I notice this when I am using KeyDown function: When I am pressing key to start the animation, releasing the key stops animation in the viewer, but animation is still looping somewhere in the background. I noticed that when I do quick press/release button on my keyboard - animation is cycling instead of starting from beginning. Quote Link to comment Share on other sites More sharing options...
Rick Posted July 6, 2016 Share Posted July 6, 2016 I'd also recommend using the AnimationManager lua class that Josh has provided. It's just a nice utility class to deal with animation/blending/complete callback. Quote Link to comment Share on other sites More sharing options...
psychoanima Posted July 6, 2016 Author Share Posted July 6, 2016 I found the answer for one part of my question. I forgot to mention that for running animation I was using Time:GetCurrent() in SetAnimationFrame, that's why I get unwanted cycling animation. My code is now like this: local isrunning = 1 function Script:Draw() if window:KeyDown(Key.C) then isrunning = isrunning +1 self.entity:SetAnimationFrame(isrunning,1,1) end now I need to figure out how to add Idle when no key is pressed and how to blend it properly. Quote Link to comment Share on other sites More sharing options...
psychoanima Posted July 6, 2016 Author Share Posted July 6, 2016 I'd also recommend using the AnimationManager lua class that Josh has provided. It's just a nice utility class to deal with animation/blending/complete callback. I am using Josh 2D platformer script example, but I have to reshape a lot of things cuz not everything is working how I wanted. I am not sure how to find AnimationManager lua class, I am rookie here, sry BTW SetInput function is a time saver for sidescroller moving! Quote Link to comment Share on other sites More sharing options...
Genebris Posted July 6, 2016 Share Posted July 6, 2016 if window:KeyDown(Key.C) then self:Run() else self:Idle() end AnimationManager.lua is in Scripts folder in FPS project template. See how it's used for crawler animation. Quote Link to comment Share on other sites More sharing options...
psychoanima Posted July 6, 2016 Author Share Posted July 6, 2016 if window:KeyDown(Key.C) then self:Run() else self:Idle() end That makes it more clean, tnx! AnimationManager.lua is in Scripts folder in FPS project template. See how it's used for crawler animation. I will investigate, thank you! 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.