Class CinemachineImpulseSource
An event-driven class that broadcasts an impulse signal to listeners.
This is the base class for custom impulse sources. It contains an impulse definition, where the characteristics of the impulse signal are defined.
API methods are provided for actually broadcasting the impulse. Call these methods from your custom code, or hook them up to game events in the Editor.
Inherited Members
Namespace: Cinemachine
Syntax
[DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
[HelpURL("https://docs.unity.cn/Packages/com.unity.cinemachine@2.8/manual/CinemachineImpulseSourceOverview.html")]
public class CinemachineImpulseSource : MonoBehaviour
Fields
m_DefaultVelocity
The default direction and force of the Impulse Signal in the absense of any specified overrides. Overrides can be specified by calling the appropriate GenerateImpulse method in the API.
Declaration
[Header("Default Invocation")]
[Tooltip("The default direction and force of the Impulse Signal in the absense of any specified overrides. Overrides can be specified by calling the appropriate GenerateImpulse method in the API.")]
public Vector3 m_DefaultVelocity
Field Value
Type | Description |
---|---|
Vector3 |
m_ImpulseDefinition
This defines the complete impulse signal that will be broadcast.
Declaration
public CinemachineImpulseDefinition m_ImpulseDefinition
Field Value
Type | Description |
---|---|
CinemachineImpulseDefinition |
Methods
GenerateImpulse()
Broadcast the Impulse Signal onto the appropriate channels, with default velocity = (0, -1, 0), and a default position which is this transform's location.
Declaration
public void GenerateImpulse()
GenerateImpulse(Single)
Legacy API: Please use GenerateImpulseWithForce() instead.
Broadcast the Impulse Signal onto the appropriate channels, using
a custom impact force, with the standard direction, and this transfom's position.
Declaration
public void GenerateImpulse(float force)
Parameters
Type | Name | Description |
---|---|---|
Single | force | The impact magnitude. 1 is normal |
GenerateImpulse(Vector3)
Legacy API: Please use GenerateImpulseWithVelocity() instead.
Broadcast the Impulse Signal onto the appropriate channels, using
a custom impact velocity, and this transfom's position.
Declaration
public void GenerateImpulse(Vector3 velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | velocity | The impact magnitude and direction |
GenerateImpulseAt(Vector3, Vector3)
Legacy API: Please use GenerateImpulseAtPositionWithVelocity() instead.
Broadcast the Impulse Signal onto the appropriate channels,
using a custom position and impact velocity
Declaration
public void GenerateImpulseAt(Vector3 position, Vector3 velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The world-space position from which the impulse will emanate |
Vector3 | velocity | The impact magnitude and direction |
GenerateImpulseAtPositionWithVelocity(Vector3, Vector3)
Broadcast the Impulse Signal onto the appropriate channels, using a custom position and impact velocity
Declaration
public void GenerateImpulseAtPositionWithVelocity(Vector3 position, Vector3 velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The world-space position from which the impulse will emanate |
Vector3 | velocity | The impact magnitude and direction |
GenerateImpulseWithForce(Single)
Broadcast the Impulse Signal onto the appropriate channels, using a custom impact force, with the standard direction, and this transfom's position.
Declaration
public void GenerateImpulseWithForce(float force)
Parameters
Type | Name | Description |
---|---|---|
Single | force | The impact magnitude. 1 is normal |
GenerateImpulseWithVelocity(Vector3)
Broadcast the Impulse Signal onto the appropriate channels, using a custom impact velocity, and this transfom's position.
Declaration
public void GenerateImpulseWithVelocity(Vector3 velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | velocity | The impact magnitude and direction |