docs.unity.cn
    Show / Hide Table of Contents

    Class RigConstraint<TJob, TData, TBinder>

    This is the base class for rig constraints. Inherit from this class to implement custom constraints.

    Inheritance
    Object
    RigConstraint<TJob, TData, TBinder>
    BlendConstraint
    ChainIKConstraint
    DampedTransform
    MultiAimConstraint
    MultiParentConstraint
    MultiPositionConstraint
    MultiReferentialConstraint
    MultiRotationConstraint
    OverrideTransform
    TwistChainConstraint
    TwistCorrection
    TwoBoneIKConstraint
    Namespace: UnityEngine.Animations.Rigging
    Syntax
    public class RigConstraint<TJob, TData, TBinder> : MonoBehaviour, IRigConstraint where TJob : struct, IWeightedAnimationJob where TData : struct, IAnimationJobData where TBinder : AnimationJobBinder<TJob, TData>, new()
    Type Parameters
    Name Description
    TJob

    The constraint job

    TData

    The constraint data

    TBinder

    The constraint job binder

    Fields

    m_Data

    The constraint data.

    Declaration
    protected TData m_Data
    Field Value
    Type Description
    TData

    m_Weight

    The constraint weight parameter.

    Declaration
    protected float m_Weight
    Field Value
    Type Description
    Single

    Properties

    data

    The data container for the constraint.

    Declaration
    public TData data { get; }
    Property Value
    Type Description
    TData

    weight

    The constraint weight. This is a value in between 0 and 1.

    Declaration
    public float weight { get; set; }
    Property Value
    Type Description
    Single
    Implements
    IRigConstraint.weight

    Methods

    CreateJob(Animator)

    Creates the animation job for this constraint.

    Declaration
    public IAnimationJob CreateJob(Animator animator)
    Parameters
    Type Name Description
    Animator animator

    The animated hierarchy Animator component

    Returns
    Type Description
    IAnimationJob

    Returns the newly instantiated job.

    Implements
    IRigConstraint.CreateJob(Animator)

    DestroyJob(IAnimationJob)

    Frees the specified job memory.

    Declaration
    public void DestroyJob(IAnimationJob job)
    Parameters
    Type Name Description
    IAnimationJob job

    The job to destroy.

    Implements
    IRigConstraint.DestroyJob(IAnimationJob)

    IsValid()

    Retrieves the constraint valid state.

    Declaration
    public bool IsValid()
    Returns
    Type Description
    Boolean

    Returns true if constraint data can be successfully evaluated. Returns false otherwise.

    Implements
    IRigConstraint.IsValid()

    OnValidate()

    This function is called when the script is loaded or a value is changed in the Inspector (Called in the editor only). You can use this to ensure that when you modify data in an editor, that data stays within a certain range.

    Declaration
    protected virtual void OnValidate()

    Reset()

    Resets constraint data to default values.

    Declaration
    public void Reset()

    UpdateJob(IAnimationJob)

    Updates the specified job data.

    Declaration
    public void UpdateJob(IAnimationJob job)
    Parameters
    Type Name Description
    IAnimationJob job

    The job to update.

    Implements
    IRigConstraint.UpdateJob(IAnimationJob)

    Explicit Interface Implementations

    IRigConstraint.binder

    The job binder for the constraint.

    Declaration
    IAnimationJobBinder IRigConstraint.binder { get; }
    Returns
    Type Description
    IAnimationJobBinder
    Implements
    IRigConstraint.binder

    IRigConstraint.component

    The component for the constraint.

    Declaration
    Component IRigConstraint.component { get; }
    Returns
    Type Description
    Component
    Implements
    IRigConstraint.component

    IRigConstraint.data

    The data container for the constraint.

    Declaration
    IAnimationJobData IRigConstraint.data { get; }
    Returns
    Type Description
    IAnimationJobData
    Implements
    IRigConstraint.data
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Tuesday, August 24, 2021