Jump to content
  • Advertisement
Sign in to follow this  
chillypacman

MultiAnimation sample seems to be geared to only loading tiny?

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

The MultiAnimation sample provided with the directx samples seems to only work with tiny_4anim.x. I've tried loading in another animated mesh but it didn't work, it jloaded it as a static mesh and didn't animate it at all. There's another sample called SkinMesh (or something) which simply loads and renders a single animated mesh, this one actually worked with my animated mesh. I'm kind of stuck, the problems I'm having are directly with the sample code that comes with the directx sdk.

Share this post


Link to post
Share on other sites
Advertisement
well im not sure but that sample is build on the tiny_4anim.x
Just check the source code and you will find lots of stuff like this::

m_dwAnimIdxLoiter = GetAnimIndex( "Loiter" );
m_dwAnimIdxWalk = GetAnimIndex( "Walk" );
m_dwAnimIdxJog = GetAnimIndex( "Jog" );
if( m_dwAnimIdxLoiter == ANIMINDEX_FAIL ||
m_dwAnimIdxWalk == ANIMINDEX_FAIL ||
m_dwAnimIdxJog == ANIMINDEX_FAIL )
return E_FAIL;

if your mesh does not have the same number of animations! with the same names!
you will have problems. Actually what do you want to archieve when loading meshes with that example?

You will need a huge amount of time to understand that example because its so dam big, you better check the skinnedMesh example and build your code like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by of_ownage
well im not sure but that sample is build on the tiny_4anim.x
Just check the source code and you will find lots of stuff like this::

m_dwAnimIdxLoiter = GetAnimIndex( "Loiter" );
m_dwAnimIdxWalk = GetAnimIndex( "Walk" );
m_dwAnimIdxJog = GetAnimIndex( "Jog" );
if( m_dwAnimIdxLoiter == ANIMINDEX_FAIL ||
m_dwAnimIdxWalk == ANIMINDEX_FAIL ||
m_dwAnimIdxJog == ANIMINDEX_FAIL )
return E_FAIL;

if your mesh does not have the same number of animations! with the same names!
you will have problems. Actually what do you want to archieve when loading meshes with that example?

You will need a huge amount of time to understand that example because its so dam big, you better check the skinnedMesh example and build your code like that.


gah, I should have mentioned I've already fixed that part, the animations match up and the actual animation seems to be loading in fine, it's just not playing at all.

all I want to do is load another mesh file that is not tiny_4anim.x and have it animated, right now it loads it up but dispalys it as static and seems to rely on the fixed function pipeline rather than shaders to handle its transforms.

But yeah, i'm considering falling back to the skinnedmesh example and just using the basic concepts from the multianimation sample to have it load multiple animated models.



and yeah the project is HUGE, the code is pretty cool though, I love how they pass in a pointer to a vector and have the push_back( this ) thing, it's really cool if not mind bending.

Share this post


Link to post
Share on other sites
Quote:
Original post by of_ownage
send me your x-file and i will try it 4 u :D


thanks! you can download it here: thatsgames.com/zombie.zip comes with the texture file and all that.

umm, it works fine in the default model viewer, just not in the damn multianimation code.

Share this post


Link to post
Share on other sites
well it only gives one error in D3DXLoadMeshHierarchyFromX

Assertion failure! (h:\gfx_sdk_november\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices

but im not sure what that means i check it again

Share this post


Link to post
Share on other sites
Quote:
Original post by of_ownage
well it only gives one error in D3DXLoadMeshHierarchyFromX

Assertion failure! (h:\gfx_sdk_november\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices

but im not sure what that means i check it again


hmm, wierd, I actually just got it working ^_^ There seems to be something strange with the code, I discovered the translation I had added to it was getting multiplied over and over and over again every frame, so if I had a position of (0, 0, 1) stored in a matrix it became (0, 0, 2) then (0, 0, 4) then (0, 0, 16). this is why I could never find the damn model in the game, it was being transformed way out of the rendering area.

I think the problem was here:

D3DXMatrixMultiply( &pFrame->TransformationMatrix,
&pFrame->TransformationMatrix,
pmxBase );


that was called once per frame and I found taht pFrame->TransformationMatrix was not being restored to its previous state, the transformation was applied, then would be applied again, then again, then again. So I just kept a copy of it and then restored it after the program was finished with the frame construction (the alternative fix would have been to apply the inverse matrix after rendering the model to cancel out the last transformation).

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!