Rasagar/Library/PackageCache/com.unity.cinemachine/Documentation~/CinemachineImpulse.md
2024-08-26 23:07:20 +03:00

1.8 KiB
Raw Blame History

Impulse

Cinemachine Impulse generates and manages camera shake in response to game events. For example, you can use Impulse to make a Cinemachine Virtual Camera shake when one GameObject collides with another, or when something in your Scene explodes.

Impulse has two parts:

1. Impulse Source: a component that emits a signal that originates at a point in space and propagates outwards, much like a sound wave or a shock wave. This emission is triggered by events in the game.

The signal consists of a direction, and a curve specifying the strength of the signal as a function of time. Together, these effectively define a shake along a specified axis, lasting a specified amount of time. This shake travels outward from the point of origin, and when it reaches the location of an Impulse Listener, that listener can respond to it.

2. Impulse Listener: a Cinemachine extension that allows a Virtual Camera to “hear” an impulse, and react to it by shaking.

Its useful to think about this in terms of individual “impulses.” An impulse is a single occurrence of an Impulse Source emitting a signal. Collisions and events in your Scenes trigger impulses, Impulse Sources generate impulses, and Impulse Listeners react to impulses.

Getting started with Impulse

To set up and use Impulse in a Scene, do the following: