Documentation

Unity Engine

Download Unity

Unity Engine

ComputeBlendSpace2DFreeformWeights(float2, in FreeformBlendSpace2DData, NativeArray<float>)

Computes the weights of a 2D freeform blend space.
Read time 1 minuteLast updated 4 hours ago

Definition

ComputeBlendSpace2DFreeformWeights(float2, FreeformBlendSpace2DData, NativeArray<float>)

public static void ComputeBlendSpace2DFreeformWeights(float2 input, in FreeformBlendSpace2DData data, NativeArray<float> outWeights)

Parameters

input

The position of the input in the blend space plane.

The precomputed blend space data. Its mode selects the algorithm.

The array that receives the weight of each animation. Its length must equal FreeformBlendSpace2DData.Count.

Remarks

The method uses FreeformBlendSpace2DData.Mode of
data
to choose the algorithm. With FreeformBlendSpace2DMode.Directional, each animation has an angle and a magnitude relative to the input. With FreeformBlendSpace2DMode.Cartesian, the weight of each animation decreases with the distance from the input to its position. The method normalizes the weights so that they sum to 1. When no animation has any weight, all animations get the same weight. An example is the center of a directional blend space without a center animation.
The method writes temporary data inside
data
although the parameter is passed with
in
, so don't call it with the same data from several threads or jobs at the same time.