bakkesmodorg/DollyCamPlugin2

Rotation Interpolation Issue

EddyNottingham opened this issue · 3 comments

As far as I can tell the minimum and maximum values on the yaw axis are -32766 and 32745.
It seems like this leap from a positive value to a negative value is causing undesirable behaviour when interpolating from a snapshot with a yaw value found on one side of this numerical boundary to a snapshot with a yaw value found on the other side of the boundary. Rather than taking the shortest route, the interpolation will spin all the way around passing through 0 to the get to the target yaw, even though the shortest and desired direction would be to spin in the opposite direction.

Ex:
Snapshot 1: Yaw=30100
Snapshot 2: Yaw=-32100

There is only a difference of ~3300 "yaw degrees" between these two Snapshots, however the interpolation causes the camera to spin ~62200 "yaw degrees" in the opposite direction passing through 0 instead of just jumping the gap from 32745 to -32766.

I think you already got a reply in the discord and got the suggestion to use a fork with spline interp. But are you sure this happens with all interp modes? It should not happen with bezier (https://github.com/bakkesmodorg/DollyCamPlugin2/blob/master/DollyCamPlugin2/interpstrategies/nbezierinterp.cpp#L52) or linear (https://github.com/bakkesmodorg/DollyCamPlugin2/blob/master/DollyCamPlugin2/interpstrategies/linearinterp.cpp#L28), but is present in catmull. Can you confirm that it is broken in linear and bezier interp?

Hi Bakkes, yes thank you, I got an excellent reply on Discord. The spline interpolation solved all of my problems. I just went in-game and can confirm that you are correct, the linear interp and bezier interp work fine, it is only the cosinus and catmull that have this problem.

I'm sorry, upon posting the issue I thought that all except linear presented this problem, but I was mistaken.

No worries, happy to know you got the info you needed from the Discord, and the fact that what's supposed to work still works 😄 . Thanks for confirming!