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

Dragging orbiter fast rotates backwards #21

Open
vorg opened this issue Feb 14, 2019 · 4 comments
Open

Dragging orbiter fast rotates backwards #21

vorg opened this issue Feb 14, 2019 · 4 comments
Labels
type/fix A bug fix

Comments

@vorg
Copy link
Member

vorg commented Feb 14, 2019

Dragging orbiter fast e.g. from right to left makes camera jump backwards before continuing rotation CW.

@vorg
Copy link
Member Author

vorg commented Feb 14, 2019

I think i nailed it!
Blue click arrow is (target) longitude and dark blue arrow is current latitude. Yellow is slerp angle. See when yellow is > 180deg slerp chooses shortest (red) path instead which is incorrect and the green position arc starts to zig zag backwards… so the problem is slerp but triggered by easing drag.

screenshot 2019-02-14 at 10 37 06 copy

Possible solutions:

  • get rid of quaternions and switch to only lat/lon (downsides = ?)
  • replace easing with inertia (1:1 tracking while dragging + "slide" on mouse up)
  • limit delta longitude to < 180deg
  • limit dx (acceleration)

@dmnsgn
Copy link
Member

dmnsgn commented Feb 14, 2019

  • get rid of quaternions and switch to only lat/lon (downsides = ?)

We'll still have the same problem of lerping to the closest target

  • replace easing with inertia (1:1 tracking while dragging + "slide" on mouse up)

Probably the best alternative to lerping

  • limit delta longitude to < 180deg

We'll need to track the dragging direction then

  • limit dx (acceleration)

Will need to be relative to the currentLon and lon properties somehow

@vorg
Copy link
Member Author

vorg commented Feb 14, 2019

I’ve just realised that current code doesn’t use quaternions. Wouldn’t the fix be then to extend interpolateAngle with direction?

interpolateAngle(
(toRadians(this.currentLon) + 2 * Math.PI) % (2 * Math.PI),
(toRadians(this.lon) + 2 * Math.PI) % (2 * Math.PI),
this.easing,
dx //positive for cw?
)

@dmnsgn
Copy link
Member

dmnsgn commented Feb 14, 2019

What if a sudden change in direction happen and the difference is > 180?

@dmnsgn dmnsgn added the type/fix A bug fix label Jul 5, 2022
@dmnsgn dmnsgn transferred this issue from pex-gl/pex-renderer May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix A bug fix
Projects
None yet
Development

No branches or pull requests

2 participants