Class AnimationNodeBlendSpace2D
A set of AnimationRootNodes placed on 2D coordinates, crossfading between the three adjacent ones. Used by AnimationTree.
- Inheritance
-
AnimationNodeBlendSpace2D
Remarks
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.add_blend_point and automatically triangulate it by setting auto_triangles to true
. Otherwise, use AnimationNodeBlendSpace2D.add_triangle and AnimationNodeBlendSpace2D.remove_triangle to triangulate the blend space by hand.
See Also
Properties
auto_triangles
If true
, the blend space is triangulated automatically. The mesh updates every time you add or remove points with AnimationNodeBlendSpace2D.add_blend_point and AnimationNodeBlendSpace2D.remove_blend_point.
var auto_triangles : bool = true
Property Value
Remarks
blend_mode
Controls the interpolation between animations. See BlendMode constants.
var blend_mode : int = 0
Property Value
Remarks
max_space
The blend space's X and Y axes' upper limit for the points' position. See AnimationNodeBlendSpace2D.add_blend_point.
var max_space : Vector2 = Vector2(1, 1)
Property Value
Remarks
min_space
The blend space's X and Y axes' lower limit for the points' position. See AnimationNodeBlendSpace2D.add_blend_point.
var min_space : Vector2 = Vector2(-1, -1)
Property Value
Remarks
snap
Position increment to snap to when moving a point.
var snap : Vector2 = Vector2(0.1, 0.1)
Property Value
Remarks
sync
If false
, the blended animations' frame are stopped when the blend value is 0
.
If true
, forcing the blended animations to advance frame.
var sync : bool = false
Property Value
Remarks
x_label
Name of the blend space's X axis.
var x_label : String = "x"
Property Value
Remarks
y_label
Name of the blend space's Y axis.
var y_label : String = "y"
Property Value
Remarks
Methods
add_blend_point(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 at_index
argument. If you use the default value for at_index
, the point is inserted at the end of the blend points array.
void add_blend_point(AnimationRootNode node, Vector2 pos, int at_index)
Parameters
node
AnimationRootNodepos
Vector2at_index
int
add_triangle(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 at_index
argument. If you use the default value for at_index
, the point is inserted at the end of the blend points array.
void add_triangle(int x, int y, int z, int at_index)
Parameters
get_blend_point_count
Qualifiers: const
Returns the number of points in the blend space.
int get_blend_point_count
get_blend_point_node(int)
Qualifiers: const
Returns the AnimationRootNode referenced by the point at index point
.
AnimationRootNode get_blend_point_node(int point)
Parameters
point
int
get_blend_point_position(int)
Qualifiers: const
Returns the position of the point at index point
.
Vector2 get_blend_point_position(int point)
Parameters
point
int
get_triangle_count
Qualifiers: const
Returns the number of triangles in the blend space.
int get_triangle_count
get_triangle_point(int, int)
Returns the position of the point at index point
in the triangle of index triangle
.
int get_triangle_point(int triangle, int point)
Parameters
remove_blend_point(int)
Removes the point at index point
from the blend space.
void remove_blend_point(int point)
Parameters
point
int
remove_triangle(int)
Removes the triangle at index triangle
from the blend space.
void remove_triangle(int triangle)
Parameters
triangle
int
set_blend_point_node(int, AnimationRootNode)
Changes the AnimationNode referenced by the point at index point
.
void set_blend_point_node(int point, AnimationRootNode node)
Parameters
point
intnode
AnimationRootNode
set_blend_point_position(int, Vector2)
Updates the position of the point at index point
in the blend space.
void set_blend_point_position(int point, Vector2 pos)
Parameters
Events
triangles_updated
Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
signal triangles_updated