• Advertisement

Archived

This topic is now archived and is closed to further replies.

Mapping events to animations

This topic is 5069 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I worked quite a lot for character animation and implemented small system for md2, md3 and skinned .x files. Now that I am able to animate and render a character I wonder how you manage everything in a game. Let''s look at a simple character that can be idle, walking and jumping. What is that best way to impplement an interface that lets you change between different animations ad what is the best way to keep track of the state the character is in. E.g OnKeyDown( KEY k ) { if ( K == FORWARD ) pCharacter->SetState( IS_WALKING ); } OnFrameMove( float dt ) { pCharacter->AdvanceTime( dt ); } void Character::AvanceTime( float dt ) { // Now that you have the current state ( or states ) // and the timestep how would you implement this function? // I don''t mean how you would interpolate the keyframes // and update the meshes, but how to manage all the states // and update the correct animations. } Maybe you share some implementation how you control you character in an application. Best regards -Dirk

Share this post


Link to post
Share on other sites
Advertisement
I simply set a "current" animation (which may actually be a blend of animations, but that''s irrelevant), and change what the "current" animation is based upon a few events that can be scripted, such as "GetHit()", "Move()" and the like.

Share this post


Link to post
Share on other sites
You want multiple levels of APIs.

1) At the top level, you may have a character that wans to get to a specific point, or wants to travel in a specific velocity, or whatever.

2) Below that, you have a system which decides on the appropriate mix of animations for the current state (not desired state).

3) Below that, you have a system which can blend any or all animations defined for a characeter, into a pose.

4) Below that, you have the system which renders a character in a pose.


Things to worry about include walking versus running versus turning animations, based on travel velocity, and avoiding foot sliding by indexing the walking/running animations based on distance traveled, not time. Other things include ease-in and ease-out between different kinds of animations to avoid snapping, IK to plant feet on the ground, and aiming by blending different arm animations (while walking with the lower body).

Share this post


Link to post
Share on other sites
Hey hplus0603,

thanx for your reply. That really sounds great! Maybe you can be a little more specific.

How did you implemented the different layers? Inheritance, several classes (delegation), functions...?

What do you mean be ease-in and ease-out (Sorry, english is not my native language)?

What about running backwards - can your system play animations backwards as well?

Regarding the states - how do you manage this.? E.g. do you use some kind of priority queue?

Maybe you have some kind of example?

-Dirk

Share this post


Link to post
Share on other sites

  • Advertisement