AnimationNodeBlendSpace2D
A set of AnimationRootNode
s placed on 2D coordinates, crossfading between the three adjacent ones. Used by AnimationTree
.
class AnimationNodeBlendSpace2D
A resource used by AnimationNodeBlendTree
.
AnimationNodeBlendSpace1D
represents a virtual 2D space on which AnimationRootNode
s are placed. Outputs the linear blend of the three adjacent animations using a Vector2
weight. Adjacent in this context means the three AnimationRootNode
s making up the triangle that contains the current value.
You can add vertices to the blend space with addBlendPoint(node:pos:atIndex:)
and automatically triangulate it by setting autoTriangles
to true
. Otherwise, use addTriangle(x:y:z:atIndex:)
and removeTriangle(_:)
to triangulate the blend space by hand.
This object emits the following signals:
Superclasses
class AnimationRootNode
Base class for
AnimationNode
s that hold one or multiple composite animations. Usually used fortreeRoot
.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var autoTriangles: Bool
If
true
, the blend space is triangulated automatically. The mesh updates every time you add or remove points withaddBlendPoint(node:pos:atIndex:)
andremoveBlendPoint(_:)
.var blendMode: AnimationNodeBlendSpace2D.BlendMode
Controls the interpolation between animations. See
BlendMode
constants.var maxSpace: Vector2
The blend space’s X and Y axes’ upper limit for the points’ position. See
addBlendPoint(node:pos:atIndex:)
.var minSpace: Vector2
The blend space’s X and Y axes’ lower limit for the points’ position. See
addBlendPoint(node:pos:atIndex:)
.var snap: Vector2
Position increment to snap to when moving a point.
var sync: Bool
If
false
, the blended animations’ frame are stopped when the blend value is0
.var trianglesUpdated: SimpleSignal
Emitted every time the blend space’s triangles are created, removed, or when one of their vertices changes position.
var xLabel: String
Name of the blend space’s X axis.
var yLabel: String
Name of the blend space’s Y axis.
func addBlendPoint(node: AnimationRootNode?, pos: Vector2, atIndex: Int32
) Adds a new point that represents a
node
at the position set bypos
. You can insert it at a specific index using theatIndex
argument. If you use the default value foratIndex
, the point is inserted at the end of the blend points array.func addTriangle(x: Int32, y: Int32, z: Int32, atIndex: Int32
) Creates a new triangle using three points
x
,y
, andz
. Triangles can overlap. You can insert the triangle at a specific index using theatIndex
argument. If you use the default value foratIndex
, the point is inserted at the end of the blend points array.func getBlendPointCount(
) -> Int32 Returns the number of points in the blend space.
func getBlendPointNode(point: Int32
) -> AnimationRootNode? Returns the
AnimationRootNode
referenced by the point at indexpoint
.func getBlendPointPosition(point: Int32
) -> Vector2 Returns the position of the point at index
point
.func getTriangleCount(
) -> Int32 Returns the number of triangles in the blend space.
func getTrianglePoint(triangle: Int32, point: Int32
) -> Int32 Returns the position of the point at index
point
in the triangle of indextriangle
.func removeBlendPoint(Int32
) Removes the point at index
point
from the blend space.func removeTriangle(Int32
) Removes the triangle at index
triangle
from the blend space.func setBlendPointNode(point: Int32, node: AnimationRootNode?
) Changes the
AnimationNode
referenced by the point at indexpoint
.func setBlendPointPosition(point: Int32, pos: Vector2
) Updates the position of the point at index
point
on the blend axis.