admin管理员组

文章数量:1194114

How can I limit horizontal rotation on OrbitControls?

Inside the code I could see that it's possible to limit it vertically using minPolarAngle and maxPolarAngle. But I couldn't find a way to limit it horizontally.

--

Edit: I know that it OrbitControls doesn't rotate the Mesh but the Camera. I just want a solution to put horizontal limits on the camera.

How can I limit horizontal rotation on OrbitControls?

Inside the code I could see that it's possible to limit it vertically using minPolarAngle and maxPolarAngle. But I couldn't find a way to limit it horizontally.

--

Edit: I know that it OrbitControls doesn't rotate the Mesh but the Camera. I just want a solution to put horizontal limits on the camera.

Share Improve this question asked Aug 14, 2014 at 13:14 armoucararmoucar 4081 gold badge4 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 29

EDIT: The ability to constrain camera movement both horizontally and vertically is a feature of OrbitControls.

// How far you can orbit vertically, upper and lower limits.
// Range is 0 to Math.PI radians.
this.minPolarAngle = 0; // radians
this.maxPolarAngle = Math.PI; // radians

// How far you can orbit horizontally, upper and lower limits.
// If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
this.minAzimuthAngle = - Infinity; // radians
this.maxAzimuthAngle = Infinity; // radians

three.js r.147

本文标签: javascriptLimit OrbitControls horizontal rotationStack Overflow