pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.76k stars 155 forks source link

Changing camera position and rotation causing vibration/stuttering #293

Open kajumito opened 2 years ago

kajumito commented 2 years ago

When changing camera position, and rotation same time I'm getting weird vibration / stuttering in objects around.

This started happening after I updated packages. I did some debugging, and found out that updating use-cannon from v0.5.4 -> v0.5.5 causes this issue or atleast made it more visible. Also after this update velocity to useSphere changes, and movement is lot slower.

Smoother with old packages (first part of the video): https://codesandbox.io/s/minecraft-old-packages-forked-fv5wm Stuttering with updated packages (latter part of the video): https://codesandbox.io/s/minecraft-new-packages-b5efn

https://user-images.githubusercontent.com/15631080/139073739-62864fbe-29c7-4702-9e27-0a5a8c3b587d.mov

After some testing I saw that there is small stuttering on older packages aswell, but it's lot harder to spot.

bjornstar commented 2 years ago

v0.5 is very old, any chance you could try a modern version?

kajumito commented 2 years ago

It's happening on all versions v0.5.5 onwards.. It was just the point where change happened that causes this bug. I just wanted to point out the specific version where this bug originates from based on my debugging.

kajumito commented 2 years ago

So I guess this specific PR #160, not sure tho!

bjornstar commented 2 years ago

It's not noticeable to me while using a trackpad on either a high-spec or a low-spec laptop. It's possible that if I were using a mouse it might feel worse.

Another possibility is the highlighting causing some hiccups, is it better without that?

kajumito commented 2 years ago

Hmm, it's even worse with trackpad for me.. Bug is not specific to this scene. Hard to say why it's not visible for you :S