Mirrored/flipped animation in imported gltf

Hey community,

I was trying to import an animated camera via gltf into a babylon scene. My original idea was after importing the gltf, then I extract the pure cam animation data from imported gltf. After that I create an brand new camera and apply extracted cam animation to the newly created cam. I was hoping this could give me a better control of the final cam animation.

But then I was implementing this idea, I realized because of the right/left coordinate system conversion, there is a __root__ node at the top level of imported gltf with 180 rotate.y and -1 scale.z. With this set up, when I apply extracted animation to the newly created cam, everything looks horizontally flipped from the new camera. Even after I created a flipped transform node on top of the new camera, the flipping effects still preserves…so if I want to continue process imported data in this way, what is the right way to do it?

Or maybe the entire “exacting gltf animation data” idea is wrong in the first place?

Please help,
Many thanks.
Tawibox

What happens if you would use scene.useRightHandedSystem = true ?

1 Like

Did you make sure to parent the cam to this flipped node before applying the animation ?
Following this Playground it works by parenting the brand new camera (camera holder is the flipped node) to the newly imported animated camera. Should be the same for applying an extracted animation.

@labris works like charm!!

After enabling this, the __root__ node no longer has that 180 in rotation.y and -1 in scaling.z anymore!! And this also fixes the flipping effects at the same time.

This is amazing. Thank you so much!
Tawibox

2 Likes

Thank you for the response!

Actually my problem was, I was trying to create new root transform node out of __root__ node, like this:
Screenshot-2024-06-05-at-14.26.41

So even I flip the camRenderRoot node, the content of the new camRender still looks flipped.

But no worry about this anymore. After I enabling the scene.useRightHandedSystem = true, all flipped issue got solved.

Thank you so much for the help!!
Tawibox