Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimationTree doesn't work right anymore godot 4 beta 14,15 #72122

Closed
VP-GAMES opened this issue Jan 26, 2023 · 7 comments
Closed

AnimationTree doesn't work right anymore godot 4 beta 14,15 #72122

VP-GAMES opened this issue Jan 26, 2023 · 7 comments

Comments

@VP-GAMES
Copy link

VP-GAMES commented Jan 26, 2023

Godot version

4.0 beta 14,15

System information

Ubuntu 22.04 1 LTS

Issue description

After update from godot4 beta 13 to beta 14 AnimationTree doesn't work right anymore.
_animation_tree.set["parameters/move_state/current"] = 1 #<= NOT WORKING
ERROR: Invalid set index 'parameters/move_state/current' (on base: 'Callable') with value of type 'int'

Change code to:
_animation_tree.set("parameters/move_state/current", 1) #<= IT WORKS BUT NOT RIGHT

Control of AnimationTree is corrupt. See appended project.

Steps to reproduce

Please download and start "Minimal reproduction project"

Minimal reproduction project

game_character_test.zip

@TokageItLab
Copy link
Member

It's not a bug. The parameter control has changed a lot, but unfortunately the documentation has not been updated, sorry. See also #71418.

@TokageItLab TokageItLab closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2023
@VP-GAMES
Copy link
Author

Thank you, for your comment. Works perfect!

@metanoia83
Copy link

metanoia83 commented Jan 29, 2023

@TokageItLab
I tried the minimal reproduction project above and already updated the code to the latest implementation.
I think the reset is only working in the editor but not on runtime. It doesn't reset the animation on runtime, instead, it is stuck at the last frame. But if you turn off the reset on the AnimationNodeTransition, then the animation works on runtime.
Not sure if this is how it is supposed to behave.
Screenshot 2023-01-28 163157

You can test the attached sample project.
game_character_test (new).zip

@TokageItLab
Copy link
Member

@metanoia83 The request should not be spammed. So it should be:

if _animation_tree.get("parameters/move_state/current_state") != "jump":
	_animation_tree.set("parameters/move_state/transition_request", "jump")

@metanoia83
Copy link

@metanoia83 The request should not be spammed. So it should be:

if _animation_tree.get("parameters/move_state/current_state") != "jump":
	_animation_tree.set("parameters/move_state/transition_request", "jump")

Do you mean like this?
image

Below is the output for the code above.

test.mp4

@TokageItLab
Copy link
Member

func handle(is_on_floor: bool, _motion: Vector2) -> void:
	if not is_on_floor:
		if _animation_tree.get("parameters/move_state/current_state") != "jump":
			_animation_tree.set("parameters/move_state/transition_request", "jump")
	else:
		if _animation_tree.get("parameters/move_state/current_state") != "move":
			_animation_tree.set("parameters/move_state/transition_request", "move")
	# Blend position for walk speed based on motion.
	_animation_tree.set("parameters/move/blend_position", _motion.length())
cap.mp4

@metanoia83
Copy link

@TokageItLab Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants