Archived

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

zelda6486

Animation With D3DX9

Recommended Posts

zelda6486    122
I am planning to store my levels and models for my games in .X files (however poor this may be) and use DirectX 9.0''s animation functions to extract and animate them. However, I have yet to find a suitable tutorial (even here on gamedev) on the subject, and the documention on msdn is very confusing. So far I have discovered this much: Call D3DXLoadMeshHierarchyFromX, which gives you a hierarchy of D3DXFRAMES, and an ID3DXAnimationController. Each Frame contains a MESHCONTAINER structure, which in turn contains materials and a mesh plus a SkinInfo interface to convert the mesh to a blended one, which in turn gives you BONECOMBINATION structs. *Phew* The AnimationController appears to have various methods for playing animations by setting the time and such, but I can''t quite figure it out. Do I have to render it myself or does the animation controller render the mesh for me when I call set time? Do I have to do something with those bone combos if I do have to? My main question is, considering I have an X file made, how do I load, animate, and render it using LoadMeshHierarchy. Example code would be greatly appreciated.

Share this post


Link to post
Share on other sites
RenderTarget    398
The AC does not render the mesh for you. All it does is set animation sets into its tracks, set events for tracks, and set the time. Setting the time (SetTime(), or AdvanceTime() in the new beta) updates the matrices in the FRAME hierarchy. Those matrices are used to render the mesh, using the SkinInfo.

There will be better animation samples in future SDKs. I wish there were a good tutorial on it too. It works really well once it''s set up, and it lets you use pretty much any method of rendering.

I like pie.

Share this post


Link to post
Share on other sites