Skip to content

Camera Shake

Amethyst-szs edited this page Dec 8, 2023 · 8 revisions

Introduction

This plugin includes an extra type of camera behavior separate from camera actions, the CameraShake node. It can be configured in the Inspector or code, then played in your application or game.

Warning: This node is heavily integrated into the rest of plugin. You cannot use camera shake if no CameraAction is active. Attempting to do so will have no effect and push a warning to the Debugger.

Methods

Interacting with camera shakes through code only requires a couple methods:

start(): Begins the camera shake using the currently set properties.

end_ease(): Ends the camera shake with easing.

end(): Ends the camera shake instantly with no easing applied.

Properties

Lifetime

The lifetime determines how long the shake is going to play. You can also enable infinite duration to make the camera shake forever until manually stopped.

Animation

The animation settings control how fast the shake moves the camera, as well as how the shake should be eased into and out of.

Speed: The speed of the camera's movement is calculated as sin(time_in_seconds * Speed). The higher the speed value, the faster the camera shakes around.

Easing: Whether the camera eases into the shake, out of the shake, both, or neither.

Ease In Length: The time in seconds that the camera will spend easing into the shake

Ease Out Length: The time in seconds the camera will spend easing out of the shake

Randomness

The randomness settings control the pseudo-random shaking that the camera will perform.

Complexity: A number ranging from 1 to 5 that controls how complex the shaking pattern is. Complexity is applied as the amount of sine waves of random lengths to average together. This means a complexity of 1 will follow a perfectly smooth random motion, while a complexity of 5 will be frantic and unpredictable.

Seed: The seed is fed into the random number generator to determine its output. If you don't like the pattern the shake is following, try a different seed.

Random Seed: Determines if the seed should be randomized every start() call. This sacrifices some control over the shake, but prevents it from getting repetitive when played multiple times.

Size

Control how far the camera is able to move, rotate, and zoom during the shake. If you want to enable rotation and zoom shaking, you need to enable them in the components section.

Horizontal Radius and Vertical Radius: Control how far the camera will shake on the X and Y axes.

Max Rotation Delta: Controls how far the camera can rotate during the shake.

Max Zoom Delta: Controls how much the camera can zoom during the shake.

Components

Toggle what parts of the camera are animated by the shake. You can toggle position, rotation, and zoom shaking.

Edit Position: Controls if the shake should affect the camera's position.

Edit Rotation: Controls if the shake should affect the camera's rotation.

Edit Zoom: Controls if the shake should affect the camera's rotation.

Clone this wiki locally