How to make a seamless animation?

I got a model with 3 animation:start-walk,walking,end-walk.
So how to make it seamless?
Any code demo please?

So, do I understand correctly that what you want is a seamless transition from “start-walk” into “walking”, and then from “walking” into “end-walk”?

If so, I would hope that “start-walk” has been designed to end in the same pose in which “walking” starts; if so, then as long as you start “walking” in the same frame as you stop “start-walk”, that transition should appear seamless.

The question then is that of seguing from “walking” to “end-walk”, as one may not know on exactly which frame “walking” will be stopped.

To this end, we have animation blending (see this part of the manual): simply adjust the “blend value” for each animation over time such that it decreases for the animation that’s ending and increases for the animation that’s starting. (This can be done in a task, or perhaps via intervals.)

Thanks for your reply.
Yes,that’s what I am talking about.

I wonder how to do it.
For example,I want to make model play “start-walk” when press “w” for a short time,maybe under 1s.
And the model will switch to play “walk” when we press “w” longer than 1s.
How do we implement that?By counting frame time?
Besides,I want to make model play different animations by pressing different buttons.
Does panda3d have something like animation state machine?
If not,I wonder if we could use FSM to do that.

Ah, I see!

That might be how I’d do it, indeed: In a task, count down a timer, and when the timer hits zero, play the next animation. You could also use the “doMethodLater” function to have Panda handle the “countdown” for you.

(In my case, I generally have an overall “update” task that handles various bits of logic, and I might pace such a timer in that, or in a method called by it.)

I don’t think that it has a state machine specific to animations, no.

It does, however, have actor intervals, which might be useful along with the “Sequences and Parallels” system. See for example this forum post.

Indeed, a Finite State Machine would likely be another good way of handling such a thing, I daresay, especially if you have a number of such animations to work with.

Again, you might use a timer-in-a-task or “doMethodLater” to instruct the Finite State Machine to transition to the next state.

OK,I will give it a try.
Thanks.

1 Like