How to set up transitions between different animations(architecture).

Started by
10 comments, last by Heelp 7 years, 4 months ago

have you considered the use of a next_animation variable? IE an animation queue with a size of one enrty: what to play next.

when you go to draw a skinned mesh, if the current_animation is over, you start the next_animation , or "IDLE" if no next_animation is set. then you tween to the current frame and draw.

as the game runs, and you determine that entities should play "some animation" next, you set the next_animation for that entity. whatever was set last is what plays next. just one possible approach.

that way you just tell it what animation to play next based on what the entity is doing, and the playback system handles the rest.

needless to say, blended animation transitions is the ultimate way to go. when its time to draw, if next_animation is set, you blend (tween) from current_animation, current_fame to next_animation, first_frame, over some number of frames (say 1 second's worth).

in state machine terms, current_animation would be the state, next_animation would be the next state. if next_animation is not set, next_state = IDLE. when an animation finishes, the animation player transitions to the next state, IE the next_animation, or IDLE. The list of all animations for an entity would be the list of possible animation states for that entity. but the only state variables required are current_animation (current state), current_frame (essentially how long before the next state change), and next_animation (the next state).

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

Norman, isn't my requestedAnimation variable doing the same stuff as you said? I just request, and when current animation is over, change to requested one. And then when the requested one is over, switch to idle. This is exactly my code, I'm glad that you think the same way, I'm on the right path then. :wink:

This topic is closed to new replies.

Advertisement