Multi Animation

Started by
6 comments, last by sansured 17 years, 9 months ago
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.
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?
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.
--------------------------Most of what I know came from Frank D. Luna's DirectX books
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.
when you set it to 0,0,0 did you mesh stop moving?
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.
hmm thats rly weird. What happens when you use 100,0,0? Does it move 100 coordinates per loop?
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.

This topic is closed to new replies.

Advertisement