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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using rotational smoothing causes snapping and camera roll #11

Open
VZout opened this issue Sep 1, 2022 · 10 comments
Open

Using rotational smoothing causes snapping and camera roll #11

VZout opened this issue Sep 1, 2022 · 10 comments

Comments

@VZout
Copy link

VZout commented Sep 1, 2022

Very high rotational smoothing values in combination with high sensitivity causes the camera to snap (to the closest quat rotation) and roll which is mildly dizzying 馃槄

@erwanvivien
Copy link

Having the same issue.

@h3r2tic Do you have an idea where in the code the bug is ? I would like to have a look, thanks

@erwanvivien
Copy link

@h3r2tic
Copy link
Owner

h3r2tic commented Feb 22, 2023

Don't know how the issue looks, so it would be hard for me to guess 馃槄 I don't currently have much time to investigate, sorry. I've seen issues with the look-at transform still having some numerical trouble; I've also seen cases where exp with large numbers can give NaNs, and also cases of quats "overflowing", and then (s)lerp suddenly switching to the other direction.

@erwanvivien
Copy link

I'll take a look 馃憣

@h3r2tic
Copy link
Owner

h3r2tic commented Feb 22, 2023

That's awesome, thanks :D

@erwanvivien
Copy link

I've dig into it a bit:

Some possible tracks:

  • interpolate should not use delta time based for it's Lerp1 ?
  • Maybe use a smooth damp instead, because it needs start and end position, which we can compute (basically rotation without lerp / smooth damp)

1: https://gamedevbeginner.com/the-right-way-to-lerp-in-unity-with-examples#lerp_slowing_down


In my tests, moving the mouse real fast, produced an interp_t of around 0.06f32 which is not much, and could cause the lerp to be wrong? I don't know much

@h3r2tic
Copy link
Owner

h3r2tic commented Feb 23, 2023

The whole point of ExpSmoothed however is to create exponential smoothing just as the article shows, where the slowing down is a feature 馃槄

@erwanvivien
Copy link

Ohhh alright 馃 Then maybe the problem is more around interp_t?

@erwanvivien
Copy link

I think there is less problem using the ExpSmoothed like you did, because in the article, it is using delta time, so it's always a small number, thus always on the slow part of the Lerp

Here the function is greatly helping the smoothing, I think ?

@h3r2tic
Copy link
Owner

h3r2tic commented Feb 23, 2023

The main difference is the framerate independence via the interp_t thing.

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

3 participants