AnimationNodeBlendSpace2D
A set of AnimationRootNodes placed on 2D coordinates, crossfading between the three adjacent ones. Used by AnimationTree.
A set of AnimationRootNodes placed on 2D coordinates, crossfading between the three adjacent ones. Used by AnimationTree.
A resource used by AnimationNodeBlendTree.
AnimationNodeBlendSpace2D represents a virtual 2D space on which AnimationRootNodes are placed. Outputs the linear blend of the three adjacent animations using a Vector2 weight. Adjacent in this context means the three AnimationRootNodes making up the triangle that contains the current value.
You can add vertices to the blend space with AnimationNodeBlendSpace2D.AddBlendPoint and automatically triangulate it by setting AnimationNodeBlendSpace2D.AutoTriangles to true. Otherwise, use AnimationNodeBlendSpace2D.AddTriangle and AnimationNodeBlendSpace2D.RemoveTriangle to triangulate the blend space by hand.
Optionally, signals can be used by setting an AnimationNodeObserverBlendSpace through AnimationTree.
var observer = animationTree.Get("parameters/BlendSpace/observer").As<AnimationNodeObserverBlendSpace>();
observer.ClosestPointChanged += OnClosestPointChanged;Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AnimationNodeBlendSpace2DConstructor
public AnimationNodeBlendSpace2D();Properties10
AutoTrianglesProperty
public bool AutoTriangles { get; set; }If true, the blend space is triangulated automatically. The mesh updates every time you add or remove points with AnimationNodeBlendSpace2D.AddBlendPoint and AnimationNodeBlendSpace2D.RemoveBlendPoint.
BlendModeProperty
public AnimationNodeBlendSpace2D.BlendModeEnum BlendMode { get; set; }Controls the interpolation between animations.
CyclicLengthProperty
public double CyclicLength { get; set; }The cycle length in seconds used by AnimationNodeBlendSpace2D.SyncModeEnum.CyclicConstant. All animations are time-scaled so they complete one full cycle in this duration. Must be greater than 0 for cyclic sync to take effect.
MaxSpaceProperty
public Vector2 MaxSpace { get; set; }The blend space's X and Y axes' upper limit for the points' position. See AnimationNodeBlendSpace2D.AddBlendPoint.
MinSpaceProperty
public Vector2 MinSpace { get; set; }The blend space's X and Y axes' lower limit for the points' position. See AnimationNodeBlendSpace2D.AddBlendPoint.
SnapProperty
public Vector2 Snap { get; set; }Position increment to snap to when moving a point.
SyncProperty · Deprecated
public bool Sync { get; set; }If true, sync mode is enabled (equivalent to AnimationNodeBlendSpace2D.SyncModeEnum.Independent). This property is kept for backward compatibility.
SyncModeProperty
public AnimationNodeBlendSpace2D.SyncModeEnum SyncMode { get; set; }Controls how animations are synced when blended. See AnimationNodeBlendSpace2D.SyncModeEnum for available options.
XLabelProperty
public string XLabel { get; set; }Name of the blend space's X axis.
YLabelProperty
public string YLabel { get; set; }Name of the blend space's Y axis.
Methods36
AddBlendPoint2 overloads
public void AddBlendPoint(AnimationRootNode node, Vector2 pos, int atIndex);Adds a new point with name that represents a node at the position set by pos. You can insert it at a specific index using the at_index argument. If you use the default value for at_index, the point is inserted at the end of the blend points array.
Note: If no name is provided, safe index is used as reference. In the future, empty names will be deprecated, so explicitly passing a name is recommended.
| Name | Type | Default |
|---|---|---|
node | AnimationRootNode | — |
pos | Vector2 | — |
atIndex | int | — |
public void AddBlendPoint(AnimationRootNode node, Vector2 pos, int atIndex = -1, StringName name = null);Adds a new point with name that represents a node at the position set by pos. You can insert it at a specific index using the at_index argument. If you use the default value for at_index, the point is inserted at the end of the blend points array.
Note: If no name is provided, safe index is used as reference. In the future, empty names will be deprecated, so explicitly passing a name is recommended.
| Name | Type | Default |
|---|---|---|
node | AnimationRootNode | — |
pos | Vector2 | — |
atIndex | int | -1 |
name | StringName | null |
AddTrianglevoid
public void AddTriangle(int x, int y, int z, int atIndex = -1);Creates a new triangle using three points x, y, and z. Triangles can overlap. You can insert the triangle at a specific index using the at_index argument. If you use the default value for at_index, the point is inserted at the end of the blend points array.
| Name | Type | Default |
|---|---|---|
x | int | — |
y | int | — |
z | int | — |
atIndex | int | -1 |
FindBlendPointByNameint
public int FindBlendPointByName(StringName name);Returns the index of the blend point with the given name. Returns -1 if no blend point with that name is found.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
intGetAutoTrianglesbool
public bool GetAutoTriangles();boolGetBlendModeAnimationNodeBlendSpace2D.BlendModeEnum
public AnimationNodeBlendSpace2D.BlendModeEnum GetBlendMode();AnimationNodeBlendSpace2D.BlendModeEnumGetBlendPointCountint
public int GetBlendPointCount();Returns the number of points in the blend space.
intGetBlendPointNameStringName
public StringName GetBlendPointName(int point);Returns the name of the blend point at index point.
| Name | Type | Default |
|---|---|---|
point | int | — |
StringNameGetBlendPointNodeAnimationRootNode
public AnimationRootNode GetBlendPointNode(int point);Returns the AnimationRootNode referenced by the point at index point.
| Name | Type | Default |
|---|---|---|
point | int | — |
AnimationRootNodeGetBlendPointPositionVector2
public Vector2 GetBlendPointPosition(int point);Returns the position of the point at index point.
| Name | Type | Default |
|---|---|---|
point | int | — |
Vector2GetCyclicLengthdouble
public double GetCyclicLength();doubleGetMaxSpaceVector2
public Vector2 GetMaxSpace();Vector2GetMinSpaceVector2
public Vector2 GetMinSpace();Vector2GetSnapVector2
public Vector2 GetSnap();Vector2GetSyncModeAnimationNodeBlendSpace2D.SyncModeEnum
public AnimationNodeBlendSpace2D.SyncModeEnum GetSyncMode();AnimationNodeBlendSpace2D.SyncModeEnumGetTriangleCountint
public int GetTriangleCount();Returns the number of triangles in the blend space.
intGetTrianglePointint
public int GetTrianglePoint(int triangle, int point);Returns the position of the point at index point in the triangle of index triangle.
| Name | Type | Default |
|---|---|---|
triangle | int | — |
point | int | — |
intGetXLabelstring
public string GetXLabel();stringGetYLabelstring
public string GetYLabel();stringIsUsingSyncbool
public bool IsUsingSync();boolRemoveBlendPointvoid
public void RemoveBlendPoint(int point);Removes the point at index point from the blend space.
| Name | Type | Default |
|---|---|---|
point | int | — |
RemoveTrianglevoid
public void RemoveTriangle(int triangle);Removes the triangle at index triangle from the blend space.
| Name | Type | Default |
|---|---|---|
triangle | int | — |
ReorderBlendPointvoid
public void ReorderBlendPoint(int fromIndex, int toIndex);Swaps the blend points at indices from_index and to_index, exchanging their positions and properties.
| Name | Type | Default |
|---|---|---|
fromIndex | int | — |
toIndex | int | — |
SetAutoTrianglesvoid
public void SetAutoTriangles(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetBlendModevoid
public void SetBlendMode(AnimationNodeBlendSpace2D.BlendModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | AnimationNodeBlendSpace2D.BlendModeEnum | — |
SetBlendPointNamevoid
public void SetBlendPointName(int point, StringName name);Sets the name of the blend point at index point. If the name conflicts with an existing point, a unique name will be generated automatically.
| Name | Type | Default |
|---|---|---|
point | int | — |
name | StringName | — |
SetBlendPointNodevoid
public void SetBlendPointNode(int point, AnimationRootNode node);Changes the AnimationNode referenced by the point at index point.
| Name | Type | Default |
|---|---|---|
point | int | — |
node | AnimationRootNode | — |
SetBlendPointPositionvoid
public void SetBlendPointPosition(int point, Vector2 pos);Updates the position of the point at index point in the blend space.
| Name | Type | Default |
|---|---|---|
point | int | — |
pos | Vector2 | — |
SetCyclicLengthvoid
public void SetCyclicLength(double length);| Name | Type | Default |
|---|---|---|
length | double | — |
SetMaxSpacevoid
public void SetMaxSpace(Vector2 maxSpace);| Name | Type | Default |
|---|---|---|
maxSpace | Vector2 | — |
SetMinSpacevoid
public void SetMinSpace(Vector2 minSpace);| Name | Type | Default |
|---|---|---|
minSpace | Vector2 | — |
SetSnapvoid
public void SetSnap(Vector2 snap);| Name | Type | Default |
|---|---|---|
snap | Vector2 | — |
SetSyncModevoid
public void SetSyncMode(AnimationNodeBlendSpace2D.SyncModeEnum syncMode);| Name | Type | Default |
|---|---|---|
syncMode | AnimationNodeBlendSpace2D.SyncModeEnum | — |
SetUseSyncvoid
public void SetUseSync(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetXLabelvoid
public void SetXLabel(string text);| Name | Type | Default |
|---|---|---|
text | string | — |
SetYLabelvoid
public void SetYLabel(string text);| Name | Type | Default |
|---|---|---|
text | string | — |
Signals and events1
TrianglesUpdatedEvent
public event Action TrianglesUpdated;Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
AnimationNodeBlendSpace2D.BlendModeEnum
| Value | Description |
|---|---|
Discrete = 1 | The blend space plays the animation of the animation node which blending position is closest to. Useful for frame-by-frame 2D animations. |
DiscreteCarry = 2 | Similar to |
Interpolated = 0 | The interpolation between animations is linear. |
AnimationNodeBlendSpace2D.SyncModeEnum
| Value | Description |
|---|---|
CyclicConstant = 3 | All animations are time-scaled so they complete one cycle in |
CyclicMutable = 2 | All animations are time-scaled so they stay in sync, with the cycle length dynamically computed from active blend weights. This is self-normalizing: a solo animation plays at normal speed.
Note: If you apply |
Independent = 1 | Inactive animations advance with a weight of |
None = 0 | Inactive animations are frozen and do not advance. |