Sign in to follow this  
w00tguy123

Rotating a 3D skeleton

Recommended Posts

w00tguy123    107
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.

Share this post


Link to post
Share on other sites
jefferytitan    2523
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.

Share this post


Link to post
Share on other sites
w00tguy123    107
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. Edited by w00tguy123

Share this post


Link to post
Share on other sites
sevenfold1    170
[quote name='w00tguy123' timestamp='1337827230' post='4942759']
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.
[/quote]

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this