foxssake / netfox

Addons for building multiplayer games with Godot
https://foxssake.github.io/netfox/
MIT License
389 stars 16 forks source link

using TickInterpolator to interpolate rotation results in a stutter during the transition between -3.14 and 3.14 #234

Closed ruguysgoingtrickortreating closed 2 months ago

ruguysgoingtrickortreating commented 2 months ago

As the title says. Recording provided (note the rotation printed to the output)

https://github.com/user-attachments/assets/14d0de0f-d875-4a45-ad98-92d676351215

ruguysgoingtrickortreating commented 2 months ago

possible workaround found: interpolate the whole transform, not the rotation and position

elementbound commented 2 months ago

Hi @ruguysgoingtrickortreating,

This stems from the way rotation works - it's the amount of rotation per axis, in Euler angles. Using Euler angles to interpolate rotations doesn't work well, as can be seen on the video. The same thing happens in animation software as well, when you try to interpolate with Euler angles.

Interpolating the whole transform works well, or alternatively, you can interpolate quaternion, which will only affect the rotation. The quaternion field also represents the node's rotation, just like rotation, but as a Quaternion, which is much better suited to interpolation.

ruguysgoingtrickortreating commented 1 month ago

This is good info, would this fit in the docs?

elementbound commented 17 hours ago

Done.