How to convert between two coordinate systems?

I am trying to convert between two coordinate systems.

const mesh = new XXX()
scene.add(mesh)

const camera = new PerspectiveCamera(45,2,1,100)
const controls = new OrbitControls(camera,document.body)

//---------------------------

// current setting
camera.position.set(0,0,30)
mesh.rotation.x = Math.PI * -0.5
mesh.rotation.z = Math.PI * -0.5


// Now, I don't want to change the rotation of mesh.
// I want to modify the properties of camera, and the final result is the same.
// What shall I do? Is there any conversion formula?
- mesh.rotation.x = Math.PI * -0.5
- mesh.rotation.z = Math.PI * -0.5
+ camera.?? = ??

Have you already studied the following topic?

There are also some code snippets that might help.

Sorry to hijack your thread but how did you hilight the last lines in red and green on Discourse ? I tried to look up for some information about this but didn’t find any.

About you issue, if you want to use another coordinates system in three.js you could just transform the scene ?

scene.rotation.x = Math.PI * 0.5
scene.rotation.z = Math.PI * 0.5

Note that if you add the camera to the scene, it will be transformed too and you won’t see any change.

You can use: ```diff

2 Likes

I finally know the answer.

Not setting the camera rotation angle, setting the .position and .up property.