Class CinemachineImpulseDefinition | Cinemachine | 2.5.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class CinemachineImpulseDefinition

    Definition of an impulse signal that gets propagated to listeners.

    Here you provide a Raw Signal source, and define an envelope for time-scaling it to craft the complete Impulse signal shape. Also, you provide here parameters that define how the signal dissipates with spatial distance from the source location. Finally, you specify the Impulse Channel on which the signal will be sent.

    An API method is provided here to take these parameters, create an Impulse Event, and broadcast it on the channel.

    When creating a custom Impulse Source class, you will have an instance of this class as a field in your custom class. Be sure also to include the [CinemachineImpulseDefinition] attribute on the field, to get the right property drawer for it.

    Inheritance
    Object
    CinemachineImpulseDefinition
    Namespace: Cinemachine
    Syntax
    [DocumentationSorting(DocumentationSortingAttribute.Level.API)]
    [Serializable]
    public class CinemachineImpulseDefinition

    Fields

    m_AmplitudeGain

    Gain to apply to the amplitudes defined in the signal source asset.

    Declaration
    [Tooltip("Gain to apply to the amplitudes defined in the signal source.  1 is normal.  Setting this to 0 completely mutes the signal.")]
    public float m_AmplitudeGain
    Field Value
    Type Description
    Single

    m_DirectionMode

    How the signal direction behaves as the listener moves away from the origin.

    Declaration
    [Tooltip("How the signal direction behaves as the listener moves away from the origin.")]
    public CinemachineImpulseManager.ImpulseEvent.DirectionMode m_DirectionMode
    Field Value
    Type Description
    CinemachineImpulseManager.ImpulseEvent.DirectionMode

    m_DissipationDistance

    At this distance beyond the impact radius, the signal will have dissipated to zero.

    Declaration
    [Tooltip("At this distance beyond the impact radius, the signal will have dissipated to zero.")]
    public float m_DissipationDistance
    Field Value
    Type Description
    Single

    m_DissipationMode

    This defines how the signal will dissipate with distance beyond the impact radius.

    Declaration
    [Tooltip("This defines how the signal will dissipate with distance beyond the impact radius.")]
    public CinemachineImpulseManager.ImpulseEvent.DissipationMode m_DissipationMode
    Field Value
    Type Description
    CinemachineImpulseManager.ImpulseEvent.DissipationMode

    m_FrequencyGain

    Scale factor to apply to the time axis.

    Declaration
    [Tooltip("Scale factor to apply to the time axis.  1 is normal.  Larger magnitudes will make the signal progress more rapidly.")]
    public float m_FrequencyGain
    Field Value
    Type Description
    Single

    m_ImpactRadius

    The signal will have full amplitude in this radius surrounding the impact point.
    Beyond that it will dissipate with distance.

    Declaration
    [Header("Spatial Range")]
    [Tooltip("The signal will have full amplitude in this radius surrounding the impact point.  Beyond that it will dissipate with distance.")]
    public float m_ImpactRadius
    Field Value
    Type Description
    Single

    m_ImpulseChannel

    Impulse events generated here will appear on the channels included in the mask.

    Declaration
    [Tooltip("Impulse events generated here will appear on the channels included in the mask.")]
    public int m_ImpulseChannel
    Field Value
    Type Description
    Int32

    m_Randomize

    Randomize the signal start time

    Declaration
    [Tooltip("Randomize the signal start time")]
    public bool m_Randomize
    Field Value
    Type Description
    Boolean

    m_RawSignal

    Defines the signal that will be generated.

    Declaration
    [Header("Signal Shape")]
    [Tooltip("Defines the signal that will be generated.")]
    [CinemachineEmbeddedAssetProperty(true)]
    public SignalSourceAsset m_RawSignal
    Field Value
    Type Description
    SignalSourceAsset

    m_RepeatMode

    How to fit the signal into the envelope time

    Declaration
    [Tooltip("How to fit the signal into the envelope time")]
    public CinemachineImpulseDefinition.RepeatMode m_RepeatMode
    Field Value
    Type Description
    CinemachineImpulseDefinition.RepeatMode

    m_TimeEnvelope

    This defines the time-envelope of the signal.
    The raw signal will be time-scaled to fit in the envelope.

    Declaration
    [Tooltip("This defines the time-envelope of the signal.  The raw signal will be time-scaled to fit in the envelope.")]
    public CinemachineImpulseManager.EnvelopeDefinition m_TimeEnvelope
    Field Value
    Type Description
    CinemachineImpulseManager.EnvelopeDefinition

    Methods

    CreateEvent(Vector3, Vector3)

    Generate an impulse event at a location in space, and broadcast it on the appropriate impulse channel

    Declaration
    public void CreateEvent(Vector3 position, Vector3 velocity)
    Parameters
    Type Name Description
    Vector3 position
    Vector3 velocity

    OnValidate()

    Call this from your behaviour's OnValidate to validate the fields here

    Declaration
    public void OnValidate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023