Class CinemachinePathBase | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class CinemachinePathBase

    Abstract base class for a world-space path, suitable for a camera dolly track.

    Inheritance
    MonoBehaviour
    CinemachinePathBase
    CinemachinePath
    CinemachineSmoothPath
    Namespace: Cinemachine
    Syntax
    public abstract class CinemachinePathBase : MonoBehaviour

    Fields

    m_Appearance

    The settings that control how the path will appear in the editor scene view.

    Declaration
    public CinemachinePathBase.Appearance m_Appearance
    Field Value
    Type Description
    CinemachinePathBase.Appearance

    m_Resolution

    Path samples per waypoint

    Declaration
    public int m_Resolution
    Field Value
    Type Description
    System.Int32

    Properties

    DistanceCacheSampleStepsPerSegment

    When calculating the distance cache, sample the path this many times between points

    Declaration
    public abstract int DistanceCacheSampleStepsPerSegment { get; }
    Property Value
    Type Description
    System.Int32

    Looped

    True if the path ends are joined to form a continuous loop

    Declaration
    public abstract bool Looped { get; }
    Property Value
    Type Description
    System.Boolean

    MaxPos

    The maximum value for the path position

    Declaration
    public abstract float MaxPos { get; }
    Property Value
    Type Description
    System.Single

    MinPos

    The minimum value for the path position

    Declaration
    public abstract float MinPos { get; }
    Property Value
    Type Description
    System.Single

    PathLength

    Get the length of the path in distance units.
    If the distance cache is not valid, then calling this will trigger a potentially costly regeneration of the path distance cache

    Declaration
    public float PathLength { get; }
    Property Value
    Type Description
    System.Single

    The length of the path in distance units, when sampled at this rate

    Methods

    DistanceCacheIsValid()

    See whether the distance cache is valid. If it's not valid, then any call to GetPathLength() or ToNativePathUnits() will trigger a potentially costly regeneration of the path distance cache

    Declaration
    public bool DistanceCacheIsValid()
    Returns
    Type Description
    System.Boolean

    Whether the cache is valid

    EvaluateOrientation(Single)

    Get the orientation the curve at a point along the path.

    Declaration
    public abstract Quaternion EvaluateOrientation(float pos)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be standardized.

    Returns
    Type Description
    Quaternion

    World-space orientation of the path

    EvaluateOrientationAtUnit(Single, CinemachinePathBase.PositionUnits)

    Get the orientation the curve at a point along the path.

    Declaration
    public Quaternion EvaluateOrientationAtUnit(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be normalized.

    CinemachinePathBase.PositionUnits units

    The unit to use when interpreting the value of pos.

    Returns
    Type Description
    Quaternion

    World-space orientation of the path

    EvaluatePosition(Single)

    Get a worldspace position of a point along the path

    Declaration
    public abstract Vector3 EvaluatePosition(float pos)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be standardized.

    Returns
    Type Description
    Vector3

    World-space position of the point along at path at pos

    EvaluatePositionAtUnit(Single, CinemachinePathBase.PositionUnits)

    Get a worldspace position of a point along the path

    Declaration
    public Vector3 EvaluatePositionAtUnit(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be normalized.

    CinemachinePathBase.PositionUnits units

    The unit to use when interpreting the value of pos.

    Returns
    Type Description
    Vector3

    World-space position of the point along at path at pos

    EvaluateTangent(Single)

    Get the tangent of the curve at a point along the path.

    Declaration
    public abstract Vector3 EvaluateTangent(float pos)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be standardized.

    Returns
    Type Description
    Vector3

    World-space direction of the path tangent. Length of the vector represents the tangent strength

    EvaluateTangentAtUnit(Single, CinemachinePathBase.PositionUnits)

    Get the tangent of the curve at a point along the path.

    Declaration
    public Vector3 EvaluateTangentAtUnit(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    Postion along the path. Need not be normalized.

    CinemachinePathBase.PositionUnits units

    The unit to use when interpreting the value of pos.

    Returns
    Type Description
    Vector3

    World-space direction of the path tangent. Length of the vector represents the tangent strength

    FindClosestPoint(Vector3, Int32, Int32, Int32)

    Find the closest point on the path to a given worldspace target point.

    Declaration
    public virtual float FindClosestPoint(Vector3 p, int startSegment, int searchRadius, int stepsPerSegment)
    Parameters
    Type Name Description
    Vector3 p

    Worldspace target that we want to approach

    System.Int32 startSegment

    In what segment of the path to start the search. A Segment is a section of path between 2 waypoints.

    System.Int32 searchRadius

    How many segments on either side of the startSegment to search. -1 means no limit, i.e. search the entire path

    System.Int32 stepsPerSegment

    We search a segment by dividing it into this many straight pieces. The higher the number, the more accurate the result, but performance is proportionally slower for higher numbers

    Returns
    Type Description
    System.Single

    The position along the path that is closest to the target point.
    The value is in Path Units, not Distance units.

    Remarks

    Performance could be improved by checking the bounding polygon of each segment, and only entering the best segment(s)

    FromPathNativeUnits(Single, CinemachinePathBase.PositionUnits)

    Get the path position (in path units) corresponding to this distance along the path.
    If the distance cache is not valid, then calling this will trigger a potentially costly regeneration of the path distance cache

    Declaration
    public float FromPathNativeUnits(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    The value to convert from, in native units

    CinemachinePathBase.PositionUnits units

    The units to convert toexpressed

    Returns
    Type Description
    System.Single

    The length of the path in distance units, when sampled at this rate

    InvalidateDistanceCache()

    Call this if the path changes in such a way as to affect distances or other cached path elements

    Declaration
    public virtual void InvalidateDistanceCache()

    MaxUnit(CinemachinePathBase.PositionUnits)

    Get the maximum value, for the given unit type

    Declaration
    public float MaxUnit(CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    CinemachinePathBase.PositionUnits units

    The unit type

    Returns
    Type Description
    System.Single

    The maximum allowable value for this path

    MinUnit(CinemachinePathBase.PositionUnits)

    Get the minimum value, for the given unit type

    Declaration
    public float MinUnit(CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    CinemachinePathBase.PositionUnits units

    The unit type

    Returns
    Type Description
    System.Single

    The minimum allowable value for this path

    StandardizePathDistance(Single)

    Standardize a distance along the path based on the path length.
    If the distance cache is not valid, then calling this will trigger a potentially costly regeneration of the path distance cache

    Declaration
    public float StandardizePathDistance(float distance)
    Parameters
    Type Name Description
    System.Single distance

    The distance to standardize

    Returns
    Type Description
    System.Single

    The standardized distance, ranging from 0 to path length

    StandardizePos(Single)

    Get a standardized path position, taking spins into account if looped

    Declaration
    public virtual float StandardizePos(float pos)
    Parameters
    Type Name Description
    System.Single pos

    Position along the path

    Returns
    Type Description
    System.Single

    Standardized position, between MinPos and MaxPos

    StandardizeUnit(Single, CinemachinePathBase.PositionUnits)

    Standardize the unit, so that it lies between MinUmit and MaxUnit

    Declaration
    public virtual float StandardizeUnit(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    The value to be standardized

    CinemachinePathBase.PositionUnits units

    The unit type

    Returns
    Type Description
    System.Single

    The standardized value of pos, between MinUnit and MaxUnit

    ToNativePathUnits(Single, CinemachinePathBase.PositionUnits)

    Get the path position (in native path units) corresponding to the psovided value, in the units indicated.
    If the distance cache is not valid, then calling this will trigger a potentially costly regeneration of the path distance cache

    Declaration
    public float ToNativePathUnits(float pos, CinemachinePathBase.PositionUnits units)
    Parameters
    Type Name Description
    System.Single pos

    The value to convert from

    CinemachinePathBase.PositionUnits units

    The units in which pos is expressed

    Returns
    Type Description
    System.Single

    The length of the path in native units, when sampled at this rate

    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