Jump to content

AnimationManager


Rick
 Share

Recommended Posts

I'm using the lua animation manager script and notice some weird stuff on some animations. It's like they were starting sort of in the middle or just not from the beginning. I removed the offset in the script but I get the same problem.

 

The first parameter name is called time, but the description says frame.

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetanimationframe-r141

 

I assume each sequence has a starting frame of 0 and goes to however long the animation is. If we pass an animation frame that is beyond the max frame count of said seq it'll loop over. So really the current way the animation manager works with the formula:

 

frame = currenttime * animation.speed

 

 

It never forces the animations to start on the first frame. It could start on any frame. This creates strange artifacts because I would expect a walk animation or strafe animation to always start on the first frame when I transition to them. The longer the animation the more noticeable this issue would be.

 

Am I missing something with doing it this way because it doesn't really seem all that acceptable as a method of doing animations.

Link to comment
Share on other sites

I assume it was done as an easy way to cycle through the frames as time is constantly increasing. This method was also used in LE2 documentation. If you want to control where the frame starts and ends then you have to program for that by simply setting the start frame then increment the frame count yourself. In LE2, I always used AppSpeed() to increment the frame count while checking for the end frame to know when it was finished.

 

psuedocode:

frame = 0
endframe = 150
...
...
if playAnimation == 1 then
  entity:Animate(frame, 1, 0, 1 )  
  frame = frame + AppSpeed()
  if frame >= endframe then
  playAnimation = 0
  frame = 0
  end
end

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
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.

Guest
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.

 Share

×
×
  • Create New...