Smooth Damp Angle vs Smooth Damp Float?

What’s the difference between Mathf.SmoothDampAngle and Mathf.SmoothDamp?

The docs (Mathf.SmoothDampAngle, Mathf.SmoothDamp) don’t say much other than one is used to change an angle and the other is used to change a value, but doing a quick log test I see that these functions compute the same value given the same parameters - so what’s the difference? Is there one?



I’ll explain the difference with a practical scenario. Let’s say you are using SmoothDamp in calculating the player’s rotation animation. If the current rotation value is 358, and the target rotation is 1, SmoothDamp is going to take you from 358 down to 1, hitting values like 300, 175, 85, etc along the way. Rather than your player doing a very small pivot to rotate to the target value, he’s going to “the long way round” and spin nearly 360 degrees to reach the target rotation.

The role of SmoothDampAngle is to provide a more useful SmoothDamp for scenarios like this. Rather than threating numbers a linear thing, it treats the angle value as a circle, so it knows to take scenarios like this, recognize that 1 is actually closer to 358 if you go “up”, so it will smooth from 358, to 359, to 360/0, to 1, so your player will rotate correctly.