Upon creation, have the Node3D scene play the specified animation right away?

Godot Version

4.3

Question

In my main scene of “debug room”, I could create a character by pressing a key on a keyboard. The code for creating a character is straight forward:

	var test_character:Node3D = load("res://test_character.tscn").instantiate()
	var animPlayer:AnimationPlayer = test_character.get_node("AnimTest/AnimationPlayer")
	animPlayer.play("test_character_idle_001Action")
	var anim:Animation = animPlayer.get_animation("test_character_idle_001Action")
	anim.loop_mode = Animation.LOOP_LINEAR	
	test_character.position = Vector3( randf_range(-1,1) , 0, randf_range(-1,1) )
	add_child(test_character)

But upon creation, I noticed that while the animation is played and looped, the test character will always play one frame of T-Pose before playing the specified animation. Is it possible to tell Godot to not show this T-Pose upon the test character creation?

I have solved my problem. It happened because I initially dragged the .glb directly into the Node3D Scene. I did a “new inherited scene” from the right click menu of .glb file, then afterward set the Current Animation to the one I wanted in the AnimationPlayer. After I added this scene as a child node of the Node3D.

In reality, perhaps I can just use the new inherited scene directly without having to create a Node3D because the new inherited scene of .glb will be a Node3D anyway.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.