Godot Version
4.4.dev3
Question
Hi!
I’m trying to get an animation from a BlendSpace, so I can get the animation length. Currently I have a simple setup with a BlendSpace1D containing 3 animations. These blend using an integer from 1-3 (indicating a certain level of animation).
In pseudocode:
var level: int = 1
var animation_length: float = blend_space.get_animation(level).length
await get_tree().create_timer(animation.length).timeout
As stated in this reddit topic I’m currently grabbing the length directly from the AnimationPlayer, which is a decent workaround.
I’ve looked into this post: Programmatically setup Animation trees? - Godot Forums
And learned there is a AnimationNodeAnimation class, which you use to programmatically assign animations to for example a AnimationNodeBlendSpace1D, and in there you can access the Animation. Maybe there is there a way to get an AnimationNodeAnimation from the BlendSpace1D?
I get access to the blendspace using graggu’s code:
var blendTree := self.animationTree.tree_root as AnimationNodeBlendTree
var blendSpace := blendTree.get_node("Block") as AnimationNodeBlendSpace1D
Where “Block” is the name of the BlendSpace1D.
Any ideas?