Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll/tilt control #500

Open
jsulli opened this issue Apr 17, 2024 · 1 comment
Open

Roll/tilt control #500

jsulli opened this issue Apr 17, 2024 · 1 comment

Comments

@jsulli
Copy link

jsulli commented Apr 17, 2024

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

  • Simply disable lookAt in the update loop. For my own testing this is all I've done - create a class property alwaysLookAtTarget: boolean (default: true), and only call lookAt in the update loop if it's true. It works as desired, but it's a bit of a brute force solution since it breaks existing rotation behavior when it's disabled.
  • A more comprehensive roll solution, with rollTo etc similar to the other control parameters, that is applied after lookAt so that it will override it. I'm unsure how well this approach 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
Copy link
Owner

yomotsu commented May 4, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants