But I’ve found that since it’s interpolating, once the player stops rotating, the character is still leaning towards the direction that the player was rotating towards until it eases back.
Do you have any suggestions on how I could mitigate this so that it only leans while rotating?
As you can see, when the camera stops rotating, the character also stops rotating, but the character is still leaning past that point which looks odd.
I understand it’s behaving exactly as I’ve set it up to do, I’m just not sure of the best way to solve it without breaking the look of the leaning otherwise.
You should probably be controlling the lean though an animation curve or a different state.
The proper math is a bit more complex, you would have to take the rotation magnitude into account by storing and checking the value against itself, on large magnitudes you know you need to lean. On small magnitudes you can apply a different factor.
When it zeros out, it would then automatically zero out faster.
So basically apply a map range clamped fed into a select float where you check the value of your ÷.
So that you have smaller leans on smaller magnitudes. If that make sense.
give it a try with a few values, see how it plays.
Finterpto should be keeping you fps independent, but limit fps to 30 and give it a check too.
if you get issues you may want to offset the lean amount by the frame time as well, so as to get more/less lean to deal with to begin with if FPS gets too low.