Rumbles

The Rumble System makes it easy for you to set up camera shakes, controller vibrations and other rumble effects in your game, based on vehicle acceleration, explosions, collisions, weapons firing and anything else you can think of.

Rumble Manager

To begin adding rumbles to your scene:

  1. Add a UVC Rumble Manager component anywhere in your scene

  2. Set the player as the Listener Game Agent in the inspector

  3. Customize the rest of the settings in the inspector

The UVC Rumble Manager reads all the rumble effects happening in the scene and calculates the overall rumble level each frame, providing a single source to get the current rumble level which is a 0-1 value.

This component is a singleton, which means there should only be one in the scene, and it can easily be accessed in any script using the static 'RumbleManager.Instance' reference.

Reading The Current Rumble Level

To get the current rumble level (0-1) in any script, simply use the following code:

// Get the current rumble level in any script
float currentRumbleLevel = RumbleManager.Instance.CurrentRumbleLevel;

Animated Rumbles

To set up an animated rumble:

  1. Add an Add Rumble component to any game object

  2. Customize the settings in the inspector

By default, the rumble will play when the object becomes active in the scene, making it useful for explosions and hit effects. You can also call the Run function like so (or add it to any Unity Event to call it when something happens):

// Run the rumble
myAddRumble.Run();

Single Frame Rumble

Besides animated rumbles, you can add a rumble level for a single frame. This makes it easy to add rumbles that are a function of some dynamic variable in the scene (such as engine throttle).

To add a single frame rumble to the scene, use the following code from any script:

// Add a rumble for this frame only.
RumbleManager.Instance.AddSingleFrameRumble(rumbleAmount, rumblePosition);

Spaceship Engine Rumbles

To add rumbles for spaceship engines:

  1. Add a Vehicle Engines 3D Rumble component somewhere on your ship

  2. Set the Engines value to the ship engines

  3. Customize the rest of the settings in the inspector

Camera Shakes

You may want to add camera shakes based on the rumble level. You can do this by adding a Rumble Shaker component to your camera and customizing the settings in the inspector.

Controller Rumbles

There are scripts to add controller rumbles if you are using either Unity's Input System or Rewired.

For Unity's Input System, simply add an Input System Gamepad Rumbles component anywhere in the scene.

For Rewired, simply add a Rewired Vibration Manager component anywhere in scene.

Last updated