Alienhead Posted March 26, 2023 Share Posted March 26, 2023 An animation plays from the starting frame ? For example - I call this player.entity:PlayAnimation("opendoor", .1, 250, 1) Notice this is a single one shot animation, no looping. But sometimes it starts at the end, at the middle, at the beginning, sometimes never see any animation at all. I've experienced this since I first started working with LE. never brought it up as it wasn't that important then, but now its is. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 Oddly, after loading the same model but using asset_unmanaged - it won't play the animation at all. This is strange, as I usually always get it to play the animation at some point in the time line. Are the animation shaders tied to each other? Like if I have 10 of the same models loaded and each model is playing a different sequence will that effect each other? I've not really ran across this problem in LE before, its got me puzzled. Just to be clear, I've tried many different models so it's not the mesh itself. The pic below, shows left mob animated in idle, the right side mob is animated in a non- loop sequence but it won't play. Every once in awhile I'll get one of the other mobs to play some random location in the sequence. Ignore the girl in t-pose, I haven't got her turned on in this part. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Solution Josh Posted March 26, 2023 Solution Share Posted March 26, 2023 I think the one-shot animation issue is something I only discovered in the Ultra code that carried over from Leadwerks. The best thing to do here is control the animation frame by setting it in each Update call. You can set the exact frame time of an animation with Entity::SetAnimationFrame 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 That's Update on the world:Update() and not the physics:Update() right ? Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted March 26, 2023 Share Posted March 26, 2023 Actually, you can use Script:Draw if you keep track of the timing. Then the animation only gets updated when the entity is drawn. Ultra is so much simpler in some aspects, it just has Update(). 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 Oh, nvm... I see now.. ty for the tip. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 12 minutes ago, Josh said: Actually, you can use Script:Draw if you keep track of the timing. Then the animation only gets updated when the entity is drawn. Ultra is so much simpler in some aspects, it just has Update(). Yes! And one day I'll be enjoying what is UltraEngine... just not this day. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted March 26, 2023 Share Posted March 26, 2023 No pressure, I am just observing its wonder and awe Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 One last question please.. Do I need to frame tween this animation sequence or is the draw command called as the physics block is? function Script:Draw() if self.anim == "atk_hard" then -- add more if player.tmr_frameplay < Time:Millisecs() then self.entity:SetAnimationFrame(player.atframe, 1.0, self.anim, true) player.atframe = player.atframe + 1 player.tmr_frameplay = Time:Millisecs() + 15 local frm = self.entity:GetAnimationLength("atk_hard") if player.atframe + 1 > frm then self.newanim = "swordidle" self.animspeed = oa_idlespeed self.animloop = 0 self.animtrans = 300 turnoveranim = true player.atframe=0 end end end end Or : ( with frame tween ) function Script:Draw() if self.anim == "atk_hard" then -- add more if player.tmr_frameplay < Time:Millisecs() then self.entity:SetAnimationFrame(player.atframe, 1.0, self.anim, true) player.atframe = player.atframe + 1 player.tmr_frameplay = Time:Millisecs() + 15 *Time:GetSpeed() local frm = self.entity:GetAnimationLength("atk_hard") if player.atframe + 1 > frm then self.newanim = "swordidle" self.animspeed = oa_idlespeed self.animloop = 0 self.animtrans = 300 turnoveranim = true player.atframe=0 end end end end Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted March 26, 2023 Share Posted March 26, 2023 Since you are adding a fixed amount to the current frame each time, I think you will need to multiply that by the speed to handle differing framerates. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted March 26, 2023 Author Share Posted March 26, 2023 Ahh I see what your talking about now.. this is much much smoother and easier to control the speed of the animation. Thanks again. function Script:Draw() if self.anim == "atk_hard" then -- add more player.atframe = player.atframe + .1 *Time:GetSpeed() self.entity:SetAnimationFrame(player.atframe, 1, self.anim, true) if player.atframe > self.entity:GetAnimationLength("atk_hard") then -- end the one-shot turnoveranim = true end end end 1 Quote I'm only happy when I'm coding, I'm only coding when I'm happy. 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.