+1 vote

Hello, everyone

Currently I am playing around with AnimationTree.

I have a state machine inside the AnimationTree, and in the state machine there is a state which is a AnimationNodeBlendTree.
Inside that AnimationNodeBlendTree, I have a blend 2 node which I want to set the blend amount through script.

So the setting is:
blend 2 node < state, which is a AnimationNodeBlendTree < state machine < AnimationTree

I have tried the following to set the blend amount but both failed:

$AnimationTree["parameters/state_machine_name/playback/state_name/blend2/blend_amount"] = 0.5

 $AnimationTree["parameters/state_machine_name/playback/state_name/blend_2/blend_amount"] = 0.5

 $AnimationTree["parameters/state_machine_name/state_name/blend2/blend_amount"] = 0.5

 $AnimationTree["parameters/state_machine_name/state_name/blend_2/blend_amount"] = 0.5

where state_machine_name is the state machine name and state_name is the state name.

So how can I set the blend amount?

in Engine by (247 points)

2 Answers

+1 vote
Best answer

Have you tried:

$AnimationTree.set("parameters/state_machine_name/state_name/blend_2/blend_amount",  0.5)

If you select the AnimationTree you'll be able to see all parameters in one place in a visual way actually:

AnimationTree parameters

In order to not mess up with naming, you can rename newly added nodes in the AnimationNodeBlendTree instead of having to deal with default naming and the parameters will be updated accordingly:

Rename node

So in my case it just translated to:

$AnimationTree.set("parameters/0/walk/direction/current", p_walk_direction)`
by (1,369 points)
selected by

I tried it but it takes no effect
Also, I have tried


but it gives me null

Oh well this could be an engine bug actually... you could try to test it out on a simpler configuration first (remove state machine) and see how it works for you.

ok it works in simpler configuration!

0 votes

You can simply hover over the property to get exact property name
enter image description here

by (104 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.