The row of spheres in the image above was created by positioning a sequence of Rigidbodies in a row and constraining their X and Z Freeze Position properties. An upward force was then applied using an Animation Curve based on the compression upward force, but with different curves for each sphere, positioned side-by-side for better visualization. You can use this technique to find the desired level of bounce for an object, or to tweak existing bounce to balance out characteristics. As a designer, being able to manipulate the characteristics of the upward force can help you create abstractions of more complex functions.
Curves are a powerful XY chart data type, and though not technically perfect, they can help you prototype speedy damping solutions that can be visually edited in the Inspector and saved as presets at runtime. In this blog on the art of damping, Alexis Bacot highlights all the things that “depend on good damping. Camera, animation, movement, color gradients, UI transitions, and many many more… it’s used everywhere! Understanding damping is key to achieving great polish. Damping alone can make the difference between a bad or good experience.”
In the same post, he demonstrates how Unity’s SmoothDamp can be used to create a beautiful ease in and out, and reacts to the target changing accurately. But it does not bounce like an “advanced spring damper that can oscillate, which is great for car suspension or fake ball physics” – an example of where Animation Curves provide a powerful advantage.
Of course, curves have more uses than as an XY data type to manipulate gameplay. They can also be treated as an evaluation tool to capture data visually using AddKey via the Unity API. For evaluating a position over time, such as damping in the vehicle suspension example, or the falling spheres, use AddKey(elapsedTime, currentSpringCompression) in a method, and then call that method and pass captureResolution as the repeating rate via InvokeRepeating. A capture resolution of 0.1f means that, at every 0.1s, a key is added to the curve. View the mini result in the Inspector, or open the graph up to see the complete data.
Source: Unity Technologies Blog