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

StateMachine animations don't play from start when triggered from a OneShot in a BlendTree #74544

Closed
Flynsarmy opened this issue Mar 7, 2023 · 1 comment

Comments

@Flynsarmy
Copy link
Contributor

Godot version

v4.0.stable.official.92bee43ad

System information

Windows 11, Vulkan API 1.3.224 - Forward+, NVIDIA - NVIDIA GeForce RTX 3070 Ti

Issue description

I have an AnimationNodeStateMachine connected to an AnimationNodeOneShot in an AnimationNodeBlendTree. The first time I fire the one shot, the StateMachine's animations play as they should. Any subsequent fires of the OneShot and the BlendTree's animations don't play. I get a 1 frame flicker but that's it. It seems like they're not resetting as they should once the StateMachine exits.

Steps to reproduce

  • New godot project
  • Have a 3D character with Idle, Jump, Falling animations
  • Add an AnimationTree to the character with AnimationNodeBlendTree root
  • In the blend tree Add the Idle animation and a StateMachine connected to a OneShot that outputs like so image
  • In the StateMachine have the Jump anim connected to Falling (switch_mode: at end) connected to End (expression get_parent().is_on_floor()) like so image
  • Give your character the following script:
extends CharacterBody3D

@onready var animation_tree: AnimationTree = $AnimationTree

func _input(event: InputEvent) -> void:
	if event.is_action_pressed("jump"):
		if not is_on_floor():
			print("can't jump. not on floor")
		else:
			velocity = Vector3(0, 100, 0)
			move_and_slide()
			animation_tree['parameters/OneShot/request'] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE

func _physics_process(delta: float) -> void:
	velocity = Vector3(0, -3, 0)
	move_and_slide()
  • Add your character to any map where he can stand on something, Set your 'jump' action in Project - Settings - Input Map and play.

On first jump he'll animation as he should. On second, third etc he won't. The StateMachine's animations aren't playing from the beginning like they should be.

Minimal reproduction project

MRP available here: https://github.com/Flynsarmy/godot4-statemachine-problem

git clone, open the project, hit play and space to jump. FIrst time it'll work, second and onwards it won't.

@clayjohn clayjohn added this to the 4.x milestone Mar 7, 2023
@TokageItLab
Copy link
Member

Dupe of #69063

@TokageItLab TokageItLab closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2023
@YuriSizov YuriSizov removed this from the 4.x milestone Jun 2, 2023
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

4 participants