Jump to content
  • Advertisement
Sign in to follow this  
sansured

Multi Animation

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

Hi, I have a problem about multi animation.In direct x sdk there is a sample which shows multi animation (skinned animation) in .x files.It's working fine but when i change mesh (Tiny.x) with another animated mesh which i made the model is moving without control.Let's i show it on the code. in the animate function in sample

  D3DXMATRIX mxWorld, mx;

    // compute world matrix based on pos/face
    D3DXMatrixRotationY( & mxWorld, -m_fFacing );
    D3DXMatrixTranslation( & mx, 0, 1, 0 );
    D3DXMatrixMultiply( & mxWorld, & mxWorld, & mx );
    D3DXMatrixMultiply( & mxWorld, & m_mxOrientation, & mxWorld );
    m_pAI->SetWorldTransform( & mxWorld );


The code shows how it set's the transform and rotation and orientation of the mesh.I mean (0,1,0) is the coordination of the mesh. Here is my problem.When i change the animated mesh my new mesh is moving :) It's not fixed in (0,1,0) position.The y position of the mesh getting increased.In every loop the coord increasing 1 unit.When i rechanged the mesh to tiny it's working fine. Do you have any idea about it? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
maybe there is a problem with your .x file which makes it move forward with every step in the animation. Are you sure that code is the source of the problem? try increasing that 1 and see if it moves forward faster. When you set it negative does it move the other direction? Does the problem stop when its 0?

Share this post


Link to post
Share on other sites
That sample does two things. It runs that various animation sets in the Tiny_4anim.x file, but those animations do not actually move Tiny around the screen/world, and secondly it has a routine to actually make the various instances of Tiny move around the world when running the jog or walk animation sets. The animations by themselves do not move Tiny around, and she will just walk or jog in place at position (0,0,0) in the world.

The code you show will indeed cause a mesh to be translated by 1 up the y-axis every time it is called. It basically adds the +1 to the y to the current world matrix each time it is called. In the sample, moving away from you requires the mesh to be translated up the y-axis, since the platform is tilted upwards on the screen.

Share this post


Link to post
Share on other sites
Quote:
The code you show will indeed cause a mesh to be translated by 1 up the y-axis every time it is called. It basically adds the +1 to the y to the current world matrix each time it is called. In the sample, moving away from you requires the mesh to be translated up the y-axis, since the platform is tilted upwards on the screen.


You are right but i am not changing the code,I am changing just the .x mesh file and my new skinned mesh's animations working fine.But it's position and rotation changing.

In both of the meshs (Tiny and my mesh) Animate function called in every loop, i checked it.

D3DXMatrixRotationY( & mxWorld, 1.2f );
D3DXMatrixTranslation( & mx, 0, 0, 0 );
D3DXMatrixMultiply( & mxWorld, & mxWorld, & mx );
m_pAI->SetWorldTransform( & mxWorld );

For example this code in Tiny situation fix Tinys coord to 0,0,0 and rotate her 1.2 units 1 time and after that she stays stable just making her animations.

But in another mesh the new mesh fix in 0,0,0 position but it's rotating constantly around the y axis.

Share this post


Link to post
Share on other sites
No when i set to 0,0,0 it's not moving.But if i set 0,1,0 or 1,0,0 or 0,0,1 in every loop the coord increasing 1 in x,y,z axis.

Share this post


Link to post
Share on other sites
Quote:
hmm thats rly weird. What happens when you use 100,0,0? Does it move 100 coordinates per loop?


Yes in that situation x corrdinate is increasing 100 units per loop.I am really confused.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!