Three.js: way to change the up axis?
16,442
You can set the camera up
vector like so:
camera.up.set( 0, 0, 1 );
Then when you call camera.lookAt( point )
, it will work as you expect.
Edit: Updated to three.js r.68
Related videos on Youtube
Author by
Eric
Updated on July 26, 2022Comments
-
Eric almost 2 years
I see that the ColladaLoader has a way to set the upAxis to 'Z' ... is there a way to do that in Three.js proper so that the camera's up axis is Z?
Thanks!
-
gimg1 almost 11 yearsIs there any workaround available so that OrbitControls will accept a change in up?
-
WestLangley almost 11 yearsNot that I am aware of. You would have to rewrite it.
-
gimg1 almost 11 yearsSo I hacked up the OrbitControls.js file so that it now works if you set z as up. I can probably make it even better so that it changes based on what up is set. Would that be helpful?
-
WestLangley almost 11 yearsYou would have to file a pull request at the three.js github site to find out.
-
z0r over 10 years
TrackballControls
seem to work well withz
as up out of the box in r62. threejs.org/examples/misc_controls_trackball.html -
user3405291 over 2 years@z0r I tested
TrackballControls
. As far as I tested, it doesn't work good withcamera.up.set( 0, 0, 1 )