Camera Shake
The Camera Shake effect rapidly changes the position and rotation of the camera to simulate the camera shaking.
💢 Settings
Multiple camera shake profiles can be created for different purposes. The following settings are available to customize on each profile:
-
Duration: The amount of seconds the camera shake lasts.
-
Acceleration: The amount of seconds it takes the camera shake to accelerate to full strength.
-
Deceleration: The amount of seconds it takes the camera shake to decay back to zero.
-
Frequency: The frequency of the noise function. A higher value results in quicker camera movements.
-
Magnitude: The magnitude of the noise vector. A higher value results in larger camera movements.
-
Positional Strength: How much the camera shake impacts the position of the camera. Set to zero to disable positional shaking.
-
Rotational Strength: How much the camera shake impacts the rotation of the camera. Set to zero to disable rotational shaking.
🖱️ Usage
Assuming you have a reference to the Camera Controller, you can get a reference to the camera shake module then activate it manually:
CameraShake cameraShake = cameraController.GetModule<CameraShake>();
cameraShake.Activate(); // default/current profile
cameraShake.Activate("GroundStomp"); // custom profile
The camera shake is automatically deactivated, but it can be manually deactivated at any time:
CameraShake cameraShake = cameraController.GetModule<CameraShake>();
cameraShake.Deactivate(); // default/current profile
cameraShake.Deactivate("GroundStomp"); // custom profile