Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the up axis in OrbitControl

Tags:

three.js

I'm doing mechanical CAD where the "up" is the Z axis (positive towards the sky), but orbitcontrol assumes that Y is the sky. I'm not really willing to change the global axes labeling in my code because it would be a nightmare in the development to jump between mechanical thinking and three.js thinking.

Is there a smart way to change the rotation axis of the control? Or some kind of very local way to change the axes just for the camera/control sub-system?

like image 456
nraynaud Avatar asked Dec 14 '22 23:12

nraynaud


1 Answers

The version of OrbitControls in the three.js dev branch will accommodate any camera.up direction.

If you want the camera to rotate around the z-axis, with the z-axis "up", just do this:

camera.up.set( 0, 0, 1 );

three.js r.67dev

like image 107
WestLangley Avatar answered Feb 12 '23 02:02

WestLangley