docs.unity3d.com
    目次を表示する/隠す

    Class AnimationRuntimeUtils

    Utility functions for runtime constraints.

    Inheritance
    Object
    AnimationRuntimeUtils
    Namespace: UnityEngine.Animations.Rigging
    Syntax
    public static class AnimationRuntimeUtils

    Methods

    InverseSolveTwoBoneIK(AnimationStream, ReadOnlyTransformHandle, ReadOnlyTransformHandle, ReadOnlyTransformHandle, ReadWriteTransformHandle, ReadWriteTransformHandle, Single, Single, Single, AffineTransform)

    Sets the position for a hint and target given bone positions.

    Declaration
    public static void InverseSolveTwoBoneIK(AnimationStream stream, ReadOnlyTransformHandle root, ReadOnlyTransformHandle mid, ReadOnlyTransformHandle tip, ReadWriteTransformHandle target, ReadWriteTransformHandle hint, float posWeight, float rotWeight, float hintWeight, AffineTransform targetOffset)
    Parameters
    Type Name Description
    AnimationStream stream

    The animation stream to work on.

    ReadOnlyTransformHandle root

    The transform handle for the root transform.

    ReadOnlyTransformHandle mid

    The transform handle for the mid transform.

    ReadOnlyTransformHandle tip

    The transform handle for the tip transform.

    ReadWriteTransformHandle target

    The transform handle for the target transform.

    ReadWriteTransformHandle hint

    The transform handle for the hint transform.

    Single posWeight

    The weight for which target position has an effect on IK calculations. This is a value in between 0 and 1.

    Single rotWeight

    The weight for which target rotation has an effect on IK calculations. This is a value in between 0 and 1.

    Single hintWeight

    The weight for which hint transform has an effect on IK calculations. This is a value in between 0 and 1.

    AffineTransform targetOffset

    The offset applied to the target transform.

    InverseSolveTwoBoneIK(Vector3, Vector3, Vector3, Quaternion, ref Vector3, ref Quaternion, ref Vector3, Boolean, Single, Single, Single, AffineTransform)

    Sets the position for a hint and target for given bone positions.

    Declaration
    public static void InverseSolveTwoBoneIK(Vector3 rootPosition, Vector3 midPosition, Vector3 tipPosition, Quaternion tipRotation, ref Vector3 targetPosition, ref Quaternion targetRotation, ref Vector3 hintPosition, bool isHintValid, float posWeight, float rotWeight, float hintWeight, AffineTransform targetOffset)
    Parameters
    Type Name Description
    Vector3 rootPosition

    The position of the root bone.

    Vector3 midPosition

    The position of the mid bone.

    Vector3 tipPosition

    The position of the tip bone.

    Quaternion tipRotation

    The rotation of the tip bone.

    Vector3 targetPosition

    The position of the target.

    Quaternion targetRotation

    The rotation of the target.

    Vector3 hintPosition

    The position of the hint.

    Boolean isHintValid

    Whether the hint position should be set.

    Single posWeight

    The weight for which target position has an effect on IK calculations. This is a value in between 0 and 1.

    Single rotWeight

    The weight for which target rotation has an effect on IK calculations. This is a value in between 0 and 1.

    Single hintWeight

    The weight for which hint transform has an effect on IK calculations. This is a value in between 0 and 1.

    AffineTransform targetOffset

    The offset applied to the target transform.

    Lerp(Vector3, Vector3, Vector3)

    Linearly interpolates between two vectors using a vector interpolant.

    Declaration
    public static Vector3 Lerp(Vector3 a, Vector3 b, Vector3 t)
    Parameters
    Type Name Description
    Vector3 a

    Start Vector3 value.

    Vector3 b

    End Vector3 value.

    Vector3 t

    Interpolant Vector3 value.

    Returns
    Type Description
    Vector3

    Interpolated value.

    PassThrough(AnimationStream, ReadWriteTransformHandle)

    Copies translation, rotation and scale values from specified Transform handle to stream.

    Declaration
    public static void PassThrough(AnimationStream stream, ReadWriteTransformHandle handle)
    Parameters
    Type Name Description
    AnimationStream stream

    The animation stream to work on.

    ReadWriteTransformHandle handle

    The transform handle to copy.

    ProjectOnPlane(Vector3, Vector3)

    Projects a vector onto a plane defined by a normal orthogonal to the plane.

    Declaration
    public static Vector3 ProjectOnPlane(Vector3 vector, Vector3 planeNormal)
    Parameters
    Type Name Description
    Vector3 vector

    The location of the vector above the plane.

    Vector3 planeNormal

    The direction from the vector towards the plane.

    Returns
    Type Description
    Vector3

    The location of the vector on the plane.

    Select(Single, Single, Single)

    Returns b if c is greater than zero, a otherwise.

    Declaration
    public static float Select(float a, float b, float c)
    Parameters
    Type Name Description
    Single a

    First float value.

    Single b

    Second float value.

    Single c

    Comparator float value.

    Returns
    Type Description
    Single

    Selected float value.

    Select(Vector3, Vector3, Vector3)

    Returns a componentwise selection between two vectors a and b based on a vector selection mask c. Per component, the component from b is selected when c is greater than zero, otherwise the component from a is selected.

    Declaration
    public static Vector3 Select(Vector3 a, Vector3 b, Vector3 c)
    Parameters
    Type Name Description
    Vector3 a

    First Vector3 value.

    Vector3 b

    Second Vector3 value.

    Vector3 c

    Comparator Vector3 value.

    Returns
    Type Description
    Vector3

    Selected Vector3 value.

    SolveFABRIK(ref NativeArray<Vector3>, ref NativeArray<Single>, Vector3, Single, Single, Int32)

    Evaluates the FABRIK ChainIK algorithm.

    Declaration
    public static bool SolveFABRIK(ref NativeArray<Vector3> linkPositions, ref NativeArray<float> linkLengths, Vector3 target, float tolerance, float maxReach, int maxIterations)
    Parameters
    Type Name Description
    NativeArray<Vector3> linkPositions

    Uninitialized buffer of positions. linkPositions and linkLengths must have the same size.

    NativeArray<Single> linkLengths

    Array of distances in between positions. linkPositions and linkLenghts must have the same size.

    Vector3 target

    Target position.

    Single tolerance

    The maximum distance the resulting position and initial target are allowed to have in between them.

    Single maxReach

    The maximum distance the Transform chain can reach.

    Int32 maxIterations

    The maximum number of iterations allowed for the ChainIK algorithm to converge to a solution.

    Returns
    Type Description
    Boolean

    Returns true if ChainIK calculations were successful. False otherwise.

    Remarks

    Implementation of unconstrained FABRIK solver : Forward and Backward Reaching Inverse Kinematic Aristidou A, Lasenby J. FABRIK: a fast, iterative solver for the inverse kinematics problem. Graphical Models 2011; 73(5): 243–260.

    SolveTwoBoneIK(AnimationStream, ReadWriteTransformHandle, ReadWriteTransformHandle, ReadWriteTransformHandle, ReadOnlyTransformHandle, ReadOnlyTransformHandle, Single, Single, Single, AffineTransform)

    Evaluates the Two-Bone IK algorithm.

    Declaration
    public static void SolveTwoBoneIK(AnimationStream stream, ReadWriteTransformHandle root, ReadWriteTransformHandle mid, ReadWriteTransformHandle tip, ReadOnlyTransformHandle target, ReadOnlyTransformHandle hint, float posWeight, float rotWeight, float hintWeight, AffineTransform targetOffset)
    Parameters
    Type Name Description
    AnimationStream stream

    The animation stream to work on.

    ReadWriteTransformHandle root

    The transform handle for the root transform.

    ReadWriteTransformHandle mid

    The transform handle for the mid transform.

    ReadWriteTransformHandle tip

    The transform handle for the tip transform.

    ReadOnlyTransformHandle target

    The transform handle for the target transform.

    ReadOnlyTransformHandle hint

    The transform handle for the hint transform.

    Single posWeight

    The weight for which target position has an effect on IK calculations. This is a value in between 0 and 1.

    Single rotWeight

    The weight for which target rotation has an effect on IK calculations. This is a value in between 0 and 1.

    Single hintWeight

    The weight for which hint transform has an effect on IK calculations. This is a value in between 0 and 1.

    AffineTransform targetOffset

    The offset applied to the target transform.

    SqrDistance(Vector3, Vector3)

    Returns the square length between two vectors.

    Declaration
    public static float SqrDistance(Vector3 lhs, Vector3 rhs)
    Parameters
    Type Name Description
    Vector3 lhs

    Vector3 value.

    Vector3 rhs

    Vector3 value.

    Returns
    Type Description
    Single

    Square length between lhs and rhs.

    Square(Single)

    Returns the square value of a float.

    Declaration
    public static float Square(float value)
    Parameters
    Type Name Description
    Single value

    Float value.

    Returns
    Type Description
    Single

    Squared value.

    Sum(NativeArray<Single>)

    Calculates the sum of all float elements in the array.

    Declaration
    public static float Sum(NativeArray<float> floatBuffer)
    Parameters
    Type Name Description
    NativeArray<Single> floatBuffer

    An array of float elements.

    Returns
    Type Description
    Single

    Sum of all float elements.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)