Rotating a 3D skeleton

Started by
2 comments, last by sevenfold1 11 years, 10 months ago
The models used in the game, Half-Life, have the Y and Z axes swapped. In my program, there is no swapping, so these models appear sideways. If I go through the .smd file and swap all Y coordinates with Z coordinates, the vertices are displayed correctly (not sideways).

If I do this with the Joints of the skeleton for animation, then it turns into a jumbled mess. I don't understand how this could happen. I figure that it's because the Joints are defined with local coordinates and orientations (relative to parent Joints), but I don't understand why that would be a problem.

Is it possible to rotate the skeletal animations without causing severe distortion? Maybe if I converted each Joint to world coordinates/orientations and then swapped the axes? It's a pain to always have to rotate the model before displaying it, and figuring out where each vertex really is (for collison) requires extra operations.
Advertisement
Could you explain in which way it becomes a jumbled mess? Are joints bending the wrong way, are bones becoming disconnected from their parents, is vertex skinning working incorrectly? It may be some weird world vs local thing, or you may be applying to swap to co-ordinates but not to transformation matrices.
It's just like me to solve the problem as soon as I ask for help... It turns out that swapping the axes for the local coordiantes was the problem. What I did was work on the skeleton with the incorrect axes and then swapped them only after the world coordinates were calculated. Now the vertices attach and display correctly and no rotations are necessary for displaying the model.

Before, the bones were rotated very oddly, causing the mesh to look pretty funny and sometimes scary looking. I'm still curious why swapping the axes at the local level causes so much weirdness, but I don't mind being dumb and happy for now.

It's just like me to solve the problem as soon as I ask for help... It turns out that swapping the axes for the local coordiantes was the problem. What I did was work on the skeleton with the incorrect axes and then swapped them only after the world coordinates were calculated. Now the vertices attach and display correctly and no rotations are necessary for displaying the model.

Before, the bones were rotated very oddly, causing the mesh to look pretty funny and sometimes scary looking. I'm still curious why swapping the axes at the local level causes so much weirdness, but I don't mind being dumb and happy for now.


Swapping local coordinates for joints doesn't work because they don't exist in same modelspace.
That's why you have to swap world coordinates, as they do exist in the same modelspace.
Or perhaps you can just swap the root joints.

This topic is closed to new replies.

Advertisement