Class Utility | Kinematica | 0.6.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class Utility

    Static class that contains various extension methods.

    Inheritance
    Object
    Utility
    Namespace: Unity.Kinematica
    Syntax
    public static class Utility

    Methods

    GetAnalogInput(Single, Single)

    Combines two floating point values into a float2 value.

    Declaration
    public static float3 GetAnalogInput(float x, float y)
    Parameters
    Type Name Description
    Single x

    The horizontal value; expected to be in the range -1 to 1.

    Single y

    The vertical value; expected to be in the range -1 to 1.

    Returns
    Type Description
    float3

    The corresponding float2 value.

    Remarks

    Normalizes the resulting float2 value if the magnitude is greater than 1.0.

    GetDesiredForwardDirection(float3, float3)

    Converts a world space vector into a relative vector w.r.t. the current main camera.

    Declaration
    public static float3 GetDesiredForwardDirection(float3 absoluteLinearVelocity, float3 forwardDirection)
    Parameters
    Type Name Description
    float3 absoluteLinearVelocity

    The world space vector to be converted.

    float3 forwardDirection

    The default forward direction, used if the linear velocity is zero.

    Returns
    Type Description
    float3

    The converted view-direction relative vector.

    GetDesiredForwardDirection(float3, float3, float3)

    Converts a world space vector into a relative vector.

    Declaration
    public static float3 GetDesiredForwardDirection(float3 absoluteLinearVelocity, float3 forwardDirection, float3 cameraForward)
    Parameters
    Type Name Description
    float3 absoluteLinearVelocity

    The world space vector to be converted.

    float3 forwardDirection

    The default forward direction, used if the linear velocity is zero.

    float3 cameraForward

    The view direction to be used for the conversion.

    Returns
    Type Description
    float3

    The converted view-direction relative vector.

    GetRelativeLinearVelocity(float3, float3)

    Converts a world space vector into a view-direction relative vector.

    Declaration
    public static float3 GetRelativeLinearVelocity(float3 absoluteLinearVelocity, float3 normalizedViewDirection)
    Parameters
    Type Name Description
    float3 absoluteLinearVelocity

    The world space vector to be converted.

    float3 normalizedViewDirection

    The normalized view direction.

    Returns
    Type Description
    float3

    The converted view-direction relative vector.

    Remarks

    For a third-person controller it is common to convert a 3d-vector into a representation that is relative to a camera. This method takes as input a normalized view direction (e.g. the forward vector of a camera transform) and converts a vector passed as argument into a vector that is relative to the view direction.

    SampleTrajectoryAtTime(MemoryArray<AffineTransform>, Single, Single)

    Declaration
    public static AffineTransform SampleTrajectoryAtTime(MemoryArray<AffineTransform> trajectory, float sampleTimeInSeconds, float timeHorizon)
    Parameters
    Type Name Description
    MemoryArray<AffineTransform> trajectory
    Single sampleTimeInSeconds
    Single timeHorizon
    Returns
    Type Description
    AffineTransform

    SteerRootMotion(AffineTransform, AffineTransform, Single, Single, Single, Single, Single)

    Returns the interpolated transform between the current and desired root motion, taking into account individual translation and rotation weights

    Declaration
    public static AffineTransform SteerRootMotion(AffineTransform rootMotion, AffineTransform desiredRootMotion, float deltaTime, float translationWeight, float rotationWeight, float startSpeed = 0F, float endSpeed = 0.15F)
    Parameters
    Type Name Description
    AffineTransform rootMotion

    Root motion to steer, represents a root delta transform for a frame

    AffineTransform desiredRootMotion

    Desired root motion toward which we steer the current root motion

    Single deltaTime

    Delta time associated to the root motion. That means root velocity for the frame is

    rootMotion.t / deltaTime

    Single translationWeight

    Interpolation weight between the root delta position at 0, and the desired delta position at 1

    Single rotationWeight

    Interpolation weight between the root delta rotation at 0, and the desired delta rotation at 1

    Single startSpeed

    Root speed (m/s) at which steering will start to be effective, steering weight will then increase linearly as root speed increases toward

    endSpeed

    Single endSpeed

    Root speed (m/s) at which steering will be fully effective

    Returns
    Type Description
    AffineTransform
    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