Springs

The spring system is an extremely powerful system which allows for smooth procedural motion without requiring any premade animations. This system is primarily used for the first person perspective, though the third person perspective also uses it for camera recoil.

The spring has a Rest State (also known as the “static equilibrium”) where it “wants to be”. If you move it away from the target value using external force, it will immediately and continuously strive back to its target position or angle. The spring Stiffness – or mechanical strength – determines how loosely or rigidly the spring behaves. Finally, the Damping makes spring velocity wear off as it approaches its rest state. Springs can be used to simulate everything from jello (a loose spring operating on object scale), an arrow hitting a wall (a very stiff spring rotating the arrow with the pivot at the head) or an underwater camera (a loose spring making the camera bounce softly as your feet hit the ocean floor).

Bobs

Bobs are the sinusoidal motion of an object or the camera. Bobbing has been around for ages in games as a means of moving the first person camera up and down while walking. Modern first person cameras don’t always have a very pronounced view bob, but bob is still very useful for animating the item model (and camera if used in moderation). If applying bob along both the x and y vector you can get interesting results such as the feeling of being a dinosaur or a huge ogre.

Noise

Procedural noise has been used in computer graphics and special effects for years as a means of generating smoke, terrains and camera shakes (to name but a few areas). The Ultimate Character Controller uses a standard perlin noise function for applying random turbulence to the first person weapon and camera. Examples include a slight breathing camera motion as you zoom in with a sniper rifle, gentle idle movements for a hand holding a sub machine gun, or the heavily disturbed camera movements of a character that is drunk or poisoned.

Inspected Fields

Any component that uses a spring can show the spring properties in the inspector.

The following fields can be modified:

Stiffness

Spring stiffness – or mechanical strength – determines how loosely or rigidly the spring behaviors. A low value will result in a soft, sway motion, and a higher value will result will stronger, stiffer movements.

Damping

Damping makes the spring velocity wear off as it approaches its rest state. Low values will result in a very loose, sway motion. Higher values will either result in a motion that quickly settles, or a stiff shaking motion. The result depends on the stiffness value.

Velocity Fade In Length

The amount of time it takes for the velocity to have its full impact. This can prevent the spring from quickly snapping to the rest position when the game is initially started.

Max Soft Force Frames

The maximum number of frames that a soft force can be spread over. The higher the value the more the spring will ease into the soft force.

Min Velocity

The minimum value of the velocity.

Max Velocity

The maximum value of the velocity.

Min Value

The minimum value of the spring.

Max Value

The maximum value of the spring.