Sign in to follow this  

Using skeletal animation to move the character

This topic is 3487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have loaded an skeletal animation and correctly set it to deform an skinned mesh. However, I want to use the translation/rotation data of the animation in order to move the character around. The main idea is to be able of playing an animation so that it moves the character as it gets played. I have access to the bones rotation/scale/translation values. When the animation is applied, it interpolates those values over time and update my skeleton bones which is used to deform the mesh. As I also have access to the skeleton root values (Bip01) I'm using those values to update the world matrix of the character. What I'm doing is this: At each frame apply the animation so that the skeleton bone's values get updated. get the Bip01 bone translation/rotation and compute the deltha from the data of the previous frame apply the delthas to the world matrix of the character save the current translation/rotation for been used in the next frame So far so good, the character moves and rotate as the animation is played. However the problem starts when switching animations or blending them. Problem 1: When playing an animation, the world matrix is updated to make the character position/rotation match the animation, but if I need to switch to another animation, I can't just stop the current animation and start playing the next animation because the starting height will be wrong. Take as an example that you are playing a running animation and you switch to a crunched animation. The new animation will use the last position of the character so it will be on the air because it was too high. The same problem happens with rotations. Suppose you are in an animation where the character is running, but while running the character is not looking forward all the time. When running the pelvis of the character is leaning left and right all the time. But if you switch to an stand animation, the heading will be not correct and will instead match the last direction of the pelvis. Problem 2: When blending beetwen a running stand animation and a running crunch animation, the delthas will not be right if the blending weights are fading from animation to the other. Question: How does standard skeletal animations handle moving the character?

Share this post


Link to post
Share on other sites
I recommend using a scene node above bip01. Use this nodes animation to move the character. Because as you've noticed the Bip01 can be all over the place.

If the bip were just relative to a base node (say between his feet, on the ground). Blending between this would be seamless for what ever animation you changed to.

Share this post


Link to post
Share on other sites
You are right, that should work. Is like also interpolating/blending the height like a normal bone.
As the Bip01 bone is not used for skinning, what I'm going to try then is to project the bip01 into the flootsteps plane. That way, the first bone of the real skeleton will be the Pelvis Bone so that it store the height.
The problem I forsee to still remaining is that the bone that waves when the player is running is the bip01, even if I project that bone to the floor, it will continue waving from left to right and therefore the character direction will seem as if constantly rotating. That could be a problem for the AI that commands the character to move forward, and instead it moves forward, but also rotate a bit while moving caused by the animation.
That problem could be solved eliminating the rotation from the bip01 and leaving it in the Pelvis bone. However, if I do that, How do I take into account when the animation is moving in a circular path and the idea is that the character direction get rotated caused by that circular movement?

Share this post


Link to post
Share on other sites
Quote:
Original post by yeisnier
That problem could be solved eliminating the rotation from the bip01 and leaving it in the Pelvis bone. However, if I do that, How do I take into account when the animation is moving in a circular path and the idea is that the character direction get rotated caused by that circular movement?


get the animator to do it ;)

using the hips rotation is a bad idea (for the reasons you anticipate), you want a bone that mimics the general path of the animation clip, but without the subtleties of the rotation that you get on the hip. As bzroom mentioned, this is probably better as a seperate bone than the actual main rig. (with some clever use of constraints within Max/Maya you should be able to re-bake the anim data on export so that it becomes a parented root bone....)

Share this post


Link to post
Share on other sites
Projecting the bone to the foot plane is going to cause all kind of unforscene issues. They are not unsolveable, but dont' waste your time. Make the Root Root bone in your rig your movement bone. You'll want to keep this as linear and smooth as possible, make all the animations relative to it.

Imagine a player getting into and out of a car. If you do the foot plane projection, you have to do all kinds of animation stretch techniques to make the animation line up with the vehicle. If his animation were relative to a movement bone, you could linearly interpolate the movement bone into the vehicle, while his animation remains relative to that.

Locking your rig and adding a bone higher on the heirarchy can be a real PITA. But if you're just getting started, this would be well worth it.

Share this post


Link to post
Share on other sites

This topic is 3487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this