Skip to main content
GameDev.net gamedev.net
🔒 Locked

FrameTransformMatrix

Started by Supernat02 Nov 23, 2003 at 11:42 PM 4 replies 1.1k views
Original Post
Supernat02
Supernat02
Hi, I have a simple question. I use truespace to export objects to x format. When I select two objects, spaced apart from each other, and export them to x format, then use the code supplied with the Advanced Animation with DirectX book, it loads the two separated meshes into the same spot on the screen. I went looking into the x file, and it looks like the object frame mesh data is converted to center on the origin before exporting. It does this to both objects, so they both are centered in the origin in model space. I need to be able to spread them back out to where I designed them. I believe the FrameTransformMatrix holds that information, which is embedded in each frame. I call UpdateHeirarchy, but that doesn''t seem to do it. Any help is appreciated. Thanks, Chris
Chris ByersMicrosoft DirectX MVP - 2005
Supernat02
Supernat02
Just to further simplify things, I am trying to load a simple scene with a box and a sphere in it, with no bones. Do I just need to manually set the world transformation matrix to the CombinedMatrix after I''ve updated the heirarchy?

Thanks,
Chris
Chris ByersMicrosoft DirectX MVP - 2005
Supernat02
Supernat02
I believe I figured out how to manually set the world matrix. Okay, I just used the frame''s combined matrix like I thought I could, set the world matrix for that, then draw the subset. My next question is...

TrueSpace seems to export the rotation that is supposed to be around the z or x axis as a rotation in the z axis. Can I switch the transformation matrix around, which components, to make the rotation occur in the z or x axis instead when I load the animation data?

Thanks,
Chris
Chris ByersMicrosoft DirectX MVP - 2005
Supernat02
Supernat02
Okay, next bit of info. The rotations are exported as quaternions in the x file. Can I re-arrange the way the data is read in from the x parser to cause it to rotate around a different axis? Or is it more complicated than that?

I feel lonely, talking to myself...lalalala

Thanks,
Chris
Chris ByersMicrosoft DirectX MVP - 2005
Supernat02
Supernat02
Ahhh, back again I am. I found one problem in the code and wanted to post it for future seekers of said problem.

Truespace exports objects under a parent frame (called Selection for instance) when you select multiple objects for the export. Then, a section is added to the x file for the animation of "Selection" and it''s merely left empty in some occassions.

Now, when you load the animation up and call the Update function from the code (code from the Advanced Animation in DirectX book), the empty selection animation resets the transformation matrix for the parent transform object to identity but doesn''t update it with animation information (because it doesn''t exist)! To fix, merely add extra conditionals to resetting the transform matrix, such as one of the movement pointers (rotation, translation, etc.) must be defined.

I hope somewhere down the line, someone finds this useful, although it doesn''t help with my other problem. The quaternions provided are rotating the object unlike it should...

Any help is appreciated.
Chris
Chris ByersMicrosoft DirectX MVP - 2005
Supernat02
Supernat02
As another update, I changed the code to instead of setting the TransformationMatrix to Identity...to change it to matOriginal.

My X file is structured as so:

Frame Selection
{
Frame Cube { Stuff and mesh }
Frame Cylinder
{
TransformMatrix Cylinder-TM {}
Frame Cylinder-extra
{
TransformMatrix Cylinder-extra-TM {}
Mesh {}
}
}
}

AnimationSet A1
{
Animation A1A
{
{Cylinder}
AnimationKey
{
Rotations and Translations.
}
}
}

Of course this is simplified. Why would the animation animate the "Cylinder" frame instead of the "Cylinder-extra" frame. The Cylinder frame doesn''t have the mesh data in it, the Cylinder-extra frame does. This may be why my quaternion rotations are off. I update the transformmatrix in the frame without the mesh in it for the animation data. Then I perform the heirarchy update. Then I draw the mesh with the frame that has the mesh data in it. Does that sound reasonable?

Chris
Chris ByersMicrosoft DirectX MVP - 2005

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.