yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.
https://yomotsu.github.io/camera-controls/
MIT License
1.89k stars 241 forks source link

Roll/tilt control #500

Open jsulli opened 2 months ago

jsulli commented 2 months ago

Is your feature request related to a problem? Please describe.

In my use-case, there are certain conditions where I need to have direct control over the roll of the camera, and the per-frame call to this._camera.lookAt(this._target) forces the roll to always be locked to maintaining a local y-up orientation.

Describe the solution you'd like

There are two broad approaches I think will work

Describe alternatives you've considered

I think it might be possible to simulate what I want by updating the cameras up-vector per-frame during transformations, but to be honest the math here is not clear to me, and I'm unsure if it will actually do what I need in terms of giving manual control over roll.

Additional context

I can make a PR for my alwaysLookAtTarget solution if the maintainers think it will fit the library design.

yomotsu commented 1 month ago

Sorry for the delay, and thanks for your feature request. However, I'm not sure rolling (or tilting, yawing) can work with orbit rotating where the camera position is on the sphere surface (as explained in the readme https://github.com/yomotsu/camera-controls?tab=readme-ov-file#orbit-rotations ).

Are you indeed attempting to use orbit rotation with roll?