🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

COLLADA Z invert

Started by
3 comments, last by RobM 3 years, 3 months ago

I noticed that when I load a collada model in my engine, it appears mirrored compared to how other systems such as Unity load it in.

I fixed this by negating Z as I import positions and normals and it’s now loading in and rendering correctly. The problem is the animations. When the model loaded as a mirror image, the animations worked correctly but, as expected with this z change, they are playing out in a very strange way, the character faces toward you but is animated back to front, if that makes sense.

To fix this I thought I’d just mirror the animation matrices and inverse bind matrices on the XY plane but this doesn’t seem to work. I did that by converting each matrix to a quarternion, negating the quarternion vector’s Z and converting the resultant quaternion back to a matrix. I did this also for the position or translation part of the matrix. I did this for both animation matrices and inverse bind matrices but it didn’t work properly. Now my character not only walks back to front but also waves his arms in the air erratically. Looks funny but not what I’m after.

Has anyone had to do anything similar with collada or any of the other formats? I’m sure I’m not doing the right thing although I can’t think why it would be wrong…

Thanks

Advertisement

I had an idea to scale the loaded entity by -1 in the z axis and that did work but it wasn’t quite the option I was looking for.

RobMadison said:
I had an idea to scale the loaded entity by -1 in the z axis

I thought that was what you meant by "negating Z".

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

I wanted to avoid scaling because I’d read that it can cause problems with normals in skeletal animation and in fact I have that very problem when using scale of -1 in the z axis. What I was trying to do before was manually change the mesh and animation matrices so I didn’t have to use scale.

This topic is closed to new replies.

Advertisement