Matching the speeds of the blended clips in a 2D blendspace

Started by
3 comments, last by lawnjelly 5 years, 5 months ago

Sup dudes and dudettes!

I'm in the process of implementing an animation state machine and am currently making a 2D blendspace state for it.
I think I've figured out how to blend the different clips together given an [x,y] coordinate but I have one problem I'm not sure how to solve; matching the different blended clips' animation speed.

Say you have your run-o-the-mill twin-stick character locomotion blendspace, where max Y, zero X means running straight forward, and max Y, max X (in either direction) means running at an angle (thus blending run_forward with run_strafe).
In this case the animations' speed probably match, so there's no worry. However, say I'm halfway up Y, meaning I'm "jogging", in the sense I'm halfway between walk_forward and run_forward, and my X is at some arbitrary point.
How would I blend these animations together so that their speeds match? Would it be as simple as 'lerping' the animation speed of the walk towards the speed of the run and scaling the speeds of all the clips to match this speed?

Sorry if the question is poorly written.
 

Advertisement

If I was blending between several loops (walk, run etc) I'd make them all over the same number of frames, so they stay in sync. Then as you say just a simple lerp between desired fps for each animation. Probably with some interplay for setting speed from code to match animation to movement and prevent foot sliding.

39 minutes ago, lawnjelly said:

If I was blending between several loops (walk, run etc) I'd make them all over the same number of frames, so they stay in sync. Then ...

I'm sure that would work but I'm not a big fan of forcing faster clips to have more frames. We're under pretty tight memory constraints for this project so every meg counts.
Perhaps one could scale the speed of the blended clips depending on the blend factor?
E.g. if you have your run with 20 frames and your walk with 30, and the blendfactor is 0.5 you could scale the speed of the run down and the walk speed up so they sync halfway (since the blendfactor is 0.5)

4 minutes ago, GreenGodDiary said:

I'm sure that would work but I'm not a big fan of forcing faster clips to have more frames. We're under pretty tight memory constraints for this project so every meg counts.
Perhaps one could scale the speed of the blended clips depending on the blend factor?
E.g. if you have your run with 20 frames and your walk with 30, and the blendfactor is 0.5 you could scale the speed of the run down and the walk speed up so they sync halfway (since the blendfactor is 0.5)

Sure, as long as you make sure you are not accumulating any e.g. float error. :)

This topic is closed to new replies.

Advertisement