Godot Version
4.5
Question
Hello! 
Im trying to trgger a cutscene whenever a body coliddes with one of my NPCs, but when i play my game, it doesn’t print what I coded it to. The NPC actually doesnt even show up, even if i replace the hide() function with a pass.
Did i do something wrong or did i miss some code? (also does anyone know how to implement a play_animation and a when_animation_finished?)
extends CharacterBody3D
@onready var timer = $"../Timer"
func on_body_entered():
print("Trigger Cutscene")
timer.start
func _on_timer_timeout() -> void:
hide()
Did you properly connect the signal to on_body_entered()?
Also, start is a function. You need to use parentheses to call it:
timer.start()
1 Like
I dont think so because it doesnt show the symbol next to it, but now in the signals tab i cant find it to reconnect my collision shape.
(Im using a ray collision to detect the player entering, or at least im trying to)
okay, so ive now connected it to an area 2d and actually connected the signal to the collision shape i wanted to detect th player.
The object, though, still isnt showing up
extends CharacterBody3D
@onready var timer = $"../Timer"
func _on_area_3d_body_entered(body: Node3D) -> void:
print("Trigger Cutscene")
timer.start()
func _on_timer_timeout() -> void:
hide()
Does it print “Trigger Cutscene”? If not then the connection is not properly set up.
1 Like
How do i check that? What should i connect (i connected the area3D node)?
Let’s see your scene tree.
1 Like
(Alrighty, my computers being weird so the image isnt working, ill just put the whole scene tree in normal text)
(NPC Scene)
CharacterBody3D
- MeshInstance3D (Capsule)
- CollisionShape3D (Capsule)
- Timer
- AnimationPlayer (With Animation I want the capsule to play in between when the codestarts and stops the timer)
- Area3D
(all the above were siblings)
and, as a child of area 3d, I have a child (collisionShape3D) that is a SeperationRayShape3D
Post a scene tree screenshot, not the text.