Archived

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

SoaringTortoise

Dumber question on character animation

Recommended Posts

Just to make sure I got this right: DX8 has no native functions for loading a frame-hierarchy, allowing you to render a particular animation frame by, for example, just saying Mesh.Render(Frame). So I have to write my own file-loader and my own frame sequencer using the DirectXFile objects. Right? This is a trivial task, but I just want to make sure I''m not off on a needless mission (and don''t tell me about that d3dFrame/d3danimation stuff... it''s unusable for my project). (I''m already using multiple .x files for animation, so the hermite spline animation side is fine, just the loading from a single mesh... which I finally managed to get working in 3dmax). Last thing to go through a tortoise''s mind before it hits the ground at 40mph? "D3DXVec3Add (Tortoise.Pos, Tortoise.Delta, Tortoise.OldPos"

Share this post


Link to post
Share on other sites
D3DX has some basic support for hierarchies (the emphasis is on basic though).

It requires you to implement a couple of interfaces, and other bits and bobs. If you''re interested I can explain the details.

Try these things in the docs..

D3DXLoadMeshHierarchyFromX
LPD3DXALLOCATEHIERARCHY
LPD3DXFRAME

Share this post


Link to post
Share on other sites
Sorry SoaringTortoise I would not want to ruin your topic, but I''m very interested to the treething''s explanation about D3DXLoadMeshHierarchyFromX
LPD3DXALLOCATEHIERARCHY
LPD3DXFRAME

Can you explain the details please?

thanks =)

Share this post


Link to post
Share on other sites
Hi. You can use D3DXLoadMeshHierarchyFromX to load a frame hierarchy from a .x file into memory. If you look at the function in the SDK docs you''ll see that it uses the ID3DXAllocateHierarchy interface. You need to create a class that inherits from this interface and implements its methods (CreateFrame, CreateMeshContainer, etc). You then pass an instance of this class into the D3DXLoadMeshHierarchyFromX function when you call it.

You can ignore the LPD3DXLOADUSERDATA and LPD3DXANIMATIONCONTROLLER interfaces for now.

The D3DXLoadMeshHierarchyFromX function scans through the .x file. Each time it finds a frame it calls the CreateFrame method that you implemented. In this function you can create the frame in whatever way you like. You can just create a D3DXFRAME object, copy the parameters, and pass it back.

In my current engine I have a scene-graph. The frame class in the scene-graph is derived from D3DXFRAME, and I create these in the CreateFrame function.

Similarly, in the CreateMeshContainer function you can create your mesh objects (derived from D3DXMESHCONTAINER), and do any post-processing that they need.

The end result of the function call should be a complete frame/mesh hierarchy, in your engines format. Very useful for things like skinned meshes, because the bones are just frames.

In my engine after the call to D3DXLoadMeshHierarchyFromX I do a pass over the new frame hierarchy to fix a few things (like parent frame pointers).

All of this is in the docs and SDK samples, though you may have to dig a little for it.

HTH,
Chris

Share this post


Link to post
Share on other sites
Ok... Thank you Treething... I''ll try to do it.

In SDK samples, I''ve found only D3DXLoadMeshHierarchy... and with google the string "D3DXLoadMeshHierarchyFromX tuuorial" return only 2 webpage... =)

between few days, I''ll come back with new questions.. ^__^

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m a newbie ... can I use an animate mesh?
I''ve read SDK,but it is too many difficult for me

I want do only pacman clone, but with static mesh it''s orribleeeee....

Can anyone help me? there is some easy tutorials?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
help me pleaseeeeee

yes I''m a kick ass.... but ... I love the videogames and I would do a pacman clone....

Share this post


Link to post
Share on other sites