---
title: ComputeBlendSpace2DFreeformWeights(float2, in FreeformBlendSpace2DData, NativeArray<float>)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/blendspaceutility/computeblendspace2dfreeformweights
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/blendspaceutility/computeblendspace2dfreeformweights.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:36:42.418Z
locale: en-us
---

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

> Computes the weights of a 2D freeform blend space.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Animations](/engine/7000.0/script-reference/unity/animations.md)
* **Assembly:** [UnityEngine.AnimationCoreModule](/engine/7000.0/script-reference/modules/unityengine-animationcoremodule.md)

## ComputeBlendSpace2DFreeformWeights(float2, FreeformBlendSpace2DData, NativeArray\<float>)

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

### Parameters

**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): The position of the input in the blend space plane.**** (\[FreeformBlendSpace2DData]\(/engine/7000.0/script-reference/unity/animations/freeformblendspace2ddata)): The precomputed blend space data. Its mode selects the algorithm.**** (\[NativeArray\<float>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): The array that receives the weight of each animation. Its length must equal [FreeformBlendSpace2DData.Count](/engine/7000.0/script-reference/unity/animations/freeformblendspace2ddata/count.md).

### Remarks

The method uses [FreeformBlendSpace2DData.Mode](/engine/7000.0/script-reference/unity/animations/freeformblendspace2ddata/mode.md) of `data` to choose the algorithm. With [FreeformBlendSpace2DMode.Directional](/engine/7000.0/script-reference/unity/animations/freeformblendspace2dmode/directional.md), each animation has an angle and a magnitude relative to the input. With [FreeformBlendSpace2DMode.Cartesian](/engine/7000.0/script-reference/unity/animations/freeformblendspace2dmode/cartesian.md), 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.
