Jump to content
  • Advertisement


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


Problem with merging MS3D animations.

This topic is 5797 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

Hello, how can I load one MS3D file with a walk animation 1 - 14, and add another animation run 1 - 18 (from an other file with the same bone structure ) on top of it. Creating a total of 32 keyframes in the keyframe array? Can I use this function? And How? void Model::setJointKeyframe( int jointIndex, int keyframeIndex, float time, float *parameter, bool isRotation ) { assert( m_numJoints > jointIndex ); Keyframe& keyframe = isRotation ? m_pJoints[jointIndex].m_pRotationKeyframes[keyframeIndex]: m_pJoints[jointIndex].m_pTranslationKeyframes[keyframeIndex]; keyframe.m_jointIndex = jointIndex; keyframe.m_time = time; memcpy( keyframe.m_parameter, parameter, sizeof( float )*3 ); } Regards opengl_coder [edited by - opengl_coder on November 9, 2002 12:18:48 PM]

Share this post

Link to post
Share on other sites
There are quite a few things you can do here. From what I understand, you want to run an animation right after another through the concatonation of the two. I am not quite sure if you want to keep the animations seperate for later individual use, but either way I have a few suggestions to make your life easier in the long run.

From what I understand of the .ms3d animation format, only the state of joints that have been modified for a particular keyframe time are stored in the file. In other words, if you have joint A and joint B starting at frame time 0.0, and at frame time 0.5 you want joint A''s position to be at said state, and at time 1.0 you want joint B at said state, there will be no record for what B''s state is at time 0.5.

Obviously, B''s state will be different at time 0.5 because it has a later keyframe at time 1.0, and so it''s state changes from time 0.0 to time 0.5.

My suggestion is to setup your bone state data in such a way that every joint has a keyframe state for every keyframe time in the entire animation. You can do this by finding each distinct keyframe time within an animation and then, through the same interpolation algorithms used to calculate the state of these joints for visualization, use these times to determine the state of each joint for every keyframe time. Incidentally, this is the way that Half-Life stores animations in it''s SMD file. Doing this will help immensly with your problem of merging two sets of animations, because the algorithm given with the ms3d ascii viewer assumes a single animation and interpolates based on searching for the next animation for a particular joint, and this causes big break-you-head problems if you want to merge two or more animations.

You can now play any animations you want after in series by keeping a skeleton state which conforms to the keyframe states you''ve calculated from the various MS3D files you''ve loaded through interpolation. You need only to set which series of keyframes your model''s skeletal state will conform to.

I also suggest that you make a stripped version of your ms3d that only contains keyframe information so that you don''t have duplicate mesh data.

I hope this helps.


Share this post

Link to post
Share on other sites
Incidentally, you could probably perform the concatonation using that function by creating a fresh Model with the proper mesh data loaded (vertices must index the right bones) and loading up the first animation regularly, and then loading up the second animation, but offsetting the frame time by the last frame of the frame in the animation.

So, if your animation goes from 1-14, and your second animation goes from 1-18,then you want to load your second animation as 14 plus the frame times of the second animation. So you end up with 15-32.

This is probably the easier way to do it than what I suggested above. However, my suggestion does allow you to easily and smoothly transition between animation states.


Share this post

Link to post
Share on other sites
Yes, I want to use two identical MS3D characters but with different animations.

1. Load main Character.1 (with walk animation 1-14)
2. Load Character.2 (with run animation 1-18)
3. Merge the animations "1-14" + "1-18" = total animation for
Character.1 (1-32)
4. Delete Character.2

I use one character for loading the model and the first keyframe data "1 - 14", and for the second one I just want to pull out the keyframe data "1 - 18" and add this to the keyframe array of the first character to a total of 32, as you said. I have done this before with the Milkshape 3D ASCII format, but I don't now how to offset and place the new keyframes on top of the others in Brett Porters MS3D Animation loader. Since I don't entirely understand how this keyframe format works.

I have maged to switch the animations, but not to add them.

Thanks for your help.



[edited by - opengl_coder on November 9, 2002 12:49:20 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!