Class AnimationNodeBlendSpace2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
A resource used by AnimationNodeBlendTree.
AnimationNodeBlendSpace1D 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 AddBlendPoint(AnimationRootNode, Vector2, int) and automatically triangulate it by setting AutoTriangles to true
. Otherwise, use AddTriangle(int, int, int, int) and RemoveTriangle(int) to triangulate the blend space by hand.
public class AnimationNodeBlendSpace2D : AnimationRootNode, IDisposable
- Inheritance
-
AnimationNodeBlendSpace2D
- Implements
- Inherited Members
Constructors
AnimationNodeBlendSpace2D()
public AnimationNodeBlendSpace2D()
Properties
AutoTriangles
If true
, the blend space is triangulated automatically. The mesh updates every time you add or remove points with AddBlendPoint(AnimationRootNode, Vector2, int) and RemoveBlendPoint(int).
public bool AutoTriangles { get; set; }
Property Value
BlendMode
Controls the interpolation between animations. See AnimationNodeBlendSpace2D.BlendModeEnum constants.
public AnimationNodeBlendSpace2D.BlendModeEnum BlendMode { get; set; }
Property Value
MaxSpace
The blend space's X and Y axes' upper limit for the points' position. See AddBlendPoint(AnimationRootNode, Vector2, int).
public Vector2 MaxSpace { get; set; }
Property Value
MinSpace
The blend space's X and Y axes' lower limit for the points' position. See AddBlendPoint(AnimationRootNode, Vector2, int).
public Vector2 MinSpace { get; set; }
Property Value
Snap
Position increment to snap to when moving a point.
public Vector2 Snap { get; set; }
Property Value
Sync
If false
, the blended animations' frame are stopped when the blend value is 0
.
If true
, forcing the blended animations to advance frame.
public bool Sync { get; set; }
Property Value
Triangles
public int[] Triangles { get; set; }
Property Value
- int[]
XLabel
Name of the blend space's X axis.
public string XLabel { get; set; }
Property Value
YLabel
Name of the blend space's Y axis.
public string YLabel { get; set; }
Property Value
Methods
AddBlendPoint(AnimationRootNode, Vector2, int)
Adds a new point that represents a node
at the position set by pos
. You can insert it at a specific index using the atIndex
argument. If you use the default value for atIndex
, the point is inserted at the end of the blend points array.
public void AddBlendPoint(AnimationRootNode node, Vector2 pos, int atIndex = -1)
Parameters
node
AnimationRootNodepos
Vector2atIndex
int
AddTriangle(int, int, int, int)
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 atIndex
argument. If you use the default value for atIndex
, the point is inserted at the end of the blend points array.
public void AddTriangle(int x, int y, int z, int atIndex = -1)
Parameters
GetBlendPointCount()
Returns the number of points in the blend space.
public int GetBlendPointCount()
Returns
GetBlendPointNode(int)
Returns the AnimationRootNode referenced by the point at index point
.
public AnimationRootNode GetBlendPointNode(int point)
Parameters
point
int
Returns
GetBlendPointPosition(int)
Returns the position of the point at index point
.
public Vector2 GetBlendPointPosition(int point)
Parameters
point
int
Returns
GetTriangleCount()
Returns the number of triangles in the blend space.
public int GetTriangleCount()
Returns
GetTrianglePoint(int, int)
Returns the position of the point at index point
in the triangle of index triangle
.
public int GetTrianglePoint(int triangle, int point)
Parameters
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
RemoveBlendPoint(int)
Removes the point at index point
from the blend space.
public void RemoveBlendPoint(int point)
Parameters
point
int
RemoveTriangle(int)
Removes the triangle at index triangle
from the blend space.
public void RemoveTriangle(int triangle)
Parameters
triangle
int
SetBlendPointNode(int, AnimationRootNode)
Changes the AnimationNode referenced by the point at index point
.
public void SetBlendPointNode(int point, AnimationRootNode node)
Parameters
point
intnode
AnimationRootNode
SetBlendPointPosition(int, Vector2)
Updates the position of the point at index point
on the blend axis.
public void SetBlendPointPosition(int point, Vector2 pos)
Parameters
Events
TrianglesUpdated
Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
public event Action TrianglesUpdated