Change GLTF coordinateSystemMode

Hi,

I want to cut a GLTF file with the CSG functions so i have to use the RightHandedSystem coordinates.

This is the playground of the cutting : https://playground.babylonjs.com/#DFD9IV#9

BUT

i’d like to go back to the LefHandedSystem coordinates mode after the cut.

I’ve read in the doc (GLTFFileLoader | Babylon.js Documentation) that it was possible to force the coordinateSystemMode in the GLTFFileLoader class to use GLTF files with the LefHandedSystem coordinates but i don’t know why.

Can someone help me ?

Thanks,

Boris

@bghgary is the king of handedness :slight_smile:

This is a legacy option that shouldn’t be used anymore.

If you want to be in left handed at the end, then you probably shouldn’t set useRightHandedSystem on the scene. You can perform the CSG in left-handed. Just make sure you don’t remove the __root__ node which has the transform to convert from right-handed glTF data to left-handed data.

https://playground.babylonjs.com/#DFD9IV#10
(EDIT: this isn’t quite right… see correct solution below: https://playground.babylonjs.com/#DFD9IV#11)

2 Likes

Ok, that is the solution.

Is it possible to remove the root node AFTER the cutting to clean the observer a little bit and not have empty root nodes.

Actually, I think my solution isn’t quite right. This is better :slight_smile:

https://playground.babylonjs.com/#DFD9IV#11

You can remove the root by using setParent(null) instead of .parent = null. The difference is that setParent will maintain the parent transforms and apply them to the child meshes.