I'm baffled by how to get a keyframe animated model to remain flat against a plane (e.g. the ground is a good example).
Take the following (very simple) example - imagine two keyframes:
Note that in both frames, the soles of the feet are against the ground plane.
The interpolated frame halfway between these is as follows:
The soles of the feet have sunk through the floor.
I understand what causes it - there are two transformations happening between the frames: the rotation of the hips and ankles and the movement up and down of the pelvis.
As the Y value of the bones involved in the rotation is obviously based on the equation of a curve, whereas the Y component of the up-down motion of the pelvis bone is just a normal linear interpolation, they move in and out of sync as you interpolate between the frames.
Putting more keyframes between them helps hide the problem, but does not address the fundamental issue, so perhaps someone out there can help.
Given that an interpolated keyframe animation is normally based on a combination of movements and rotations, how do you interpolate without sinking through the floor plane between frames?
Any help on this would be much appreciated.
I've come up with one solution to this, although I'm not sure if it is the best.
I'm either moving existing bones where possible or adding dummy bones if needed so that there is a bone location at every possible extremity of the character. For a character that just walks, these are just at the tips and heels of the feet and tips of the hands, although this would vary depending on the animations.
Once I've generated the matrix palette from the skeleton, it is actually then quite trivial to get the minimum and maximum x and y values of all the bones based on the current pose and the y-axis rotation.
These can then be used to generate an accurate bounding box around the skeleton in an arbitrary interpolated pose and as long as the positions of the extremity bones match the extremity vertices of the model, all should then work okay.
Feels a bit over-complicated though. I'd still be interested to know how normal games handle this.