Archived

This topic is now archived and is closed to further replies.

zarma

Spline movements for character animation

Recommended Posts

Hi. I have to move skinned characters in the world. The animation datas come from a mocap solution. The root bone has translation keys. The problem is to move the character along a spline path (built from a path finding solver). I remove the root translation at display and get a relative root bone translation vector. The problem is that: - Get the length of the spline - from the relative root bone translation length, get the correct vertex on the spline Here is my spline code: double t2=t*t; double t3=t*t*t; double k1=1-3*t+3*t2-t3; double k2=4-6*t2+3*t3; double k3=1+3*t+3*t2-3*t3; bspline.x = 1/6.0*(k1*v1->x+ k2*v2->x+ k3*v3->x+ t3*v4->x); bspline.y = 1/6.0*(k1*v1->y+ k2*v2->y+ k3*v3->y+ t3*v4->y); bspline.z = 1/6.0*(k1*v1->z+ k2*v2->z+ k3*v3->z+ t3*v4->z); v1 is n-1th vertex v2 is nth vertex v3 and v4 are n+1th and n+2th vertex t is factor (0 to 1) to get splined vertex between v2 and v3 I don''t see how to get an elegant and efficient way. Thanks.

Share this post


Link to post
Share on other sites
I''d like to ask a few questions to see if I understand your problem.

Are you trying to convert the root bone translation vector from the mocap data into the distance travelled along the spline? So, basically if at time = current_time, the mocap says that the root bone has travelled a distance, x, then you are looking to find the vertex along the locomotion path that is a distance x along the path? Is this correct?

I''ll point you to a document that may help----if the the above confirms that I understand your problem.

Moving At Constant Speed (parameterize by arc length)

It is the parameterization by arc length in that documentation that you may find useful.

I''ve worked this problem before for our own games, and I will warn you that you will find some difficulty if you are applying mocap walk cycles to motion along a nonlinear path. Reason is that the root bone will include translations in all 3 directions due to hip motion. For path following you would want to apply only the forward direction component of the mocap data to the locomotion path. Then, apply the side-to-side and up/down mocap data as offsets that are perpendicular to the path. Its a bit tricky to get right, but can look really good.

You will also have the problem of foot sliding unless you are retargeting the feet using IK or physics. For gentle spline paths its hardly noticeable, but if the character makes sharp turns the foot sliding is obvious and ugly. But, many games have this problem and it doesn''t make the game less fun, .


Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
Yes, you understood the problem. I''m checking the document.
Concerning hip motions, I only use straight walk/run cycle animation. I make some kind of vertex masking.

m_translationAbsolute = m_CurrentKey.m_Trans;

m_translationAbsolute.x*=m_RootBoneMask.x;
m_translationAbsolute.y*=m_RootBoneMask.y;
m_translationAbsolute.z*=m_RootBoneMask.z;

If the character mocap moves along the X axis, I set the mask as (0,1,1).
To make things simple, I set the character rotation (Z axis) corresponding to spline tangent. So, I don''t have problem with left/right/up/down moves. If the path becomes to sharp, I''ll have to play another animation (player stops, returns and restart walking).

Share this post


Link to post
Share on other sites