---
title: ComputeBlendSpace2DSimpleDirectionalWeights(float2, NativeArray<float2>, 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/computeblendspace2dsimpledirectionalweights
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/blendspaceutility/computeblendspace2dsimpledirectionalweights.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:30:00.750Z
locale: en-us
---

# ComputeBlendSpace2DSimpleDirectionalWeights(float2, NativeArray<float2>, NativeArray<float>)

> Computes the weights of a 2D simple directional 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)

```csharp
public static void ComputeBlendSpace2DSimpleDirectionalWeights(float2 input, NativeArray<float2> values, NativeArray<float> outWeights)
```

### Parameters

**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): The position of the input in the blend space plane, in the same space as the positions in `values`.**** (\[NativeArray\<float2>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): The position of each animation in the blend space.**** (\[NativeArray\<float>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): The array that receives the weight of each animation. Its length must equal the length of `values`.

### Remarks

Use this method when the animations sit in different directions around an optional center point, for example walk animations in four directions. For other layouts, use [BlendSpaceUtility.ComputeBlendSpace2DFreeformWeights](/engine/7000.0/script-reference/unity/animations/blendspaceutility/computeblendspace2dfreeformweights.md).

Each animation has a position in the plane. An animation at `(0, 0)` is the center animation. On each side of the input direction, the method picks the animation whose direction is closest to the direction of the input, and blends the two picks with the center animation. The closer the input is to `(0, 0)`, the more weight the center animation gets. If no animation sits on one side of the input direction, the center gets all the weight. If no animation sits at `(0, 0)`, the weight of the center is divided equally among all animations.

Only the direction of a position, not its distance from the center, selects an animation. If several animations sit in the same direction from the center, the method picks only one of them.

Place at most one animation at `(0, 0)`. If two or more animations sit at `(0, 0)` and the input isn't `(0, 0)`, the method sets every weight to 0. This matches the **2D Simple Directional** blend tree.

This method needs only the positions of the animations. The freeform method needs a [FreeformBlendSpace2DData](/engine/7000.0/script-reference/unity/animations/freeformblendspace2ddata.md) that you create once for the positions.
