Transitioning between arbitrary frames

Apr 30, 2011 at 7:39 AM

I think it should allow for smoother animation. If character needs to run and developer wants transition netween “walking” and “running” animations, then if running animation starts from the left leg, developer needs to wait until walking animation reach leading left leg to start running. Otherwise animation will look clumsy. Can someone review a patch or is there another way for that kind of scenario? :)

Apr 30, 2011 at 1:09 PM

To use this, you'll need to know which keyframe in your walk animation corresponds to the current keyframe in the run animation, right?

This is a good idea, as my current solutions (ForceAnimationSwitch or using multiple versions of the target animation) to this problem aren't very elegant, but I don't like this implementation either. It's far too easy to pass a keyframe index that's out of range and get an exception thrown. While we could easily do a sanity test on the input values, it's still clumsy to use. I think it's too much to information for them keep track of. (If you disagree, please show me an example of how you're using this in your code.)

While I don't like sending in the raw keyframe indices, I'd like to discuss other ways to do this. Here's one:

We could add a new field to the keyframes, similar to the keyframe trigger strings, that we could use as identifiers for named transition points. Then we could have a transition method that looks for the nearest named transition point (forward or backward) and then transitions from that to the corresponding named transition point in the target animation.

I notice that you're using Linq in UpdateBonePositions. I was under the impression that using Linq functions would generate garbage at runtime (something I've tried very hard to avoid.) Do you know if that's the case?