Camera starting on its side

Hello,

I’m attempting to set up the initial position of the camera in my 3D scene but the camera appears to be flipped on its side every time. This is resulting in weird controls to try and correct for it.
I’m using TrackballControls so trying to use camera.rotation.z/x/y etc hasn’t worked. I’ve tried using LookAt to force it to look in a certain direction but the camera is still flipped.
I’ve now tried using: camera.position.set(0,0,10); to start top down, but ideally I’d like the camera to place infront of my object so it can start being viewed straight away.

Any help on this would be great, thanks.

You may be building your scene sideways. In threejs the “up” axis is Y, and you may be used to Z being up or are using content generation tools that assume Z up.
If you are loading your scene or stuff from a gltf file or similar… you may have to rotate it -90 degrees around the X axis to turn it into Y up.

I often have to do like…

gltf.scene.rotation.x=-Math.PI*.5;
scene.add(gltf.scene)
1 Like

Brilliant. This worked straight away.
Thanks!

1 Like