Documentation

Unity Engine

Download Unity

Unity Engine

ComputeLocalToWorldLinearVelocities

Computes the linear velocity of each bone in world space, from two consecutive streams of the same rig.
Read time 1 minuteLast updated 4 hours ago

Definition

ComputeLocalToWorldLinearVelocities(float4x4, float4x4, AnimationStream, AnimationStream, float, NativeArray<float3>)

public static void ComputeLocalToWorldLinearVelocities(float4x4 localToWorld, float4x4 previousLocalToWorld, ref AnimationStream input, ref AnimationStream previousInput, float deltaTime, NativeArray<float3> outVelocities)

Parameters

localToWorld

The
LocalToWorld
matrix of the character at the time of
input
.

previousLocalToWorld

The
LocalToWorld
matrix of the character at the time of
previousInput
.

The stream for the current update.

previousInput

The stream for the previous update. It must use the same rig as
input
.

deltaTime

The time between the two streams, in seconds. It must not be zero.

outVelocities

Receives the velocity of each bone, in units per second. The length must be equal to the bone count of the rig.

Remarks

The velocity of a bone is the change of its world position between the two streams, divided by the elapsed time. The world position of a bone is its
LocalToCharacter
translation transformed by the
LocalToWorld
matrix.