Axis/vector3 direction

Hey guys is there a way to change the default direction of the the Z axis? At the moment setting the position of a mesh to a positive Z direction would move them away from the user. I actually need it to be opposite.

Well, it depends on where you put your camera.

In your PG it is located in (0,0,-15) and is looking at the (0,0,1) direction. If you set it in (0,0,15) instead it will look at the (0,0,-1) direction:

https://playground.babylonjs.com/#L51MG7#1

The only problem with this is now the X axis is going to the left direction instead of the right. Besides placing the cameras, is there a method to transform the coordinate system of the world space?

Probably the simplest way is to negate your z values before setting them?

yah that would be my last resort. I’m building something similar to AutoCAD and I’m already too deep in the code. If there’s a way to change the axis direction on the same view would save me a lot of time.

Try scene.useRightHanded…
Look in scene api docs as i don’t recall exact name.

However, im not sure exactly what it changes (z inverted like gltf or if y/z swaps too)

2 Likes

wow I think this is it. I could start putting the camera the other side to start off like @Evgeni_Popov said then use scene.useRightHandedSystem=true; Thanks man this saves me tons of time than negative each mesh :slight_smile: