📹Camera Shake

In this section you will learn about the camera shakes.

Camera Shake is an important aspect of the camera animation in game. The FPS Animation Framework allows you to play the camera shakes in runtime, by simply accessing the FPSCamera component:

_fpsCameraController.PlayCameraShake(cameraShake);

The cameraShake parameter is a Scriptable Object, which you can create by right-clicking:

Create -> KINEMATION -> FPS Animator General -> Camera Shake

X, Y and Z are animation curves, which animate the respective rotation axis.

Pitch, Yaw and Roll represent the ranges for minimum and maximum target values. The value is computed using this formula:

public static float GetTarget(Vector4 value)
{
    float a = Random.Range(value.x, value.y);
    float b = Random.Range(value.z, value.w);
    return Random.Range(0, 2) == 0 ? a : b;
}

Smooth Speed defines the interpolation speed.

Play Rate defines the animation speed.

Last updated