Godot Version
4.7.stable
I’m new to Godot and I’m having a problem with the door label.
This is the scene at the door
The CollisionShape3D of both Area3D and StaticBody3D have the same dimensions.
This is the CollisionShape3D script for the door
extends StaticBody3D
var Open1 := false
var Interact := true
@export var Animation_Door: AnimationPlayer
func interact_door():
if Interact == true:
Interact = false
Open1 = !Open1
if Open1 == false:
Animation_Door.play("close_door")
if Open1 == true:
Animation_Door.play("open_door")
await get_tree().create_timer(1.0, false).timeout
Interact = true
This is how I have constructed the character.
This CharacterBody3D script is designed to make the label appear on the door if Raycast3D detects an Area3D.
@onready var label: Label = $Control/Label
@onready var raycast: RayCast3D = $Node3D/RayCast3D
#----------------------
func _process(_delta: float) -> void:
if raycast.is_colliding():
var colision = raycast.get_collider()
if colision is Area3D:
label.text = "[E]"
else:
label.text = ""
This is the script RayCast3D calls the door function
extends RayCast3D
func _process(_delta):
if is_colliding():
var Activate = get_collider()
if Activate.has_method("interact_door") and Input.is_action_just_pressed("accion"):
Activate.interact_door()
The problem is that only 1 out of 2 things works.
- The label appears but I can’t open the door.
- The door opens but the label doesn’t appear.
How can I fix this? Where is it done incorrectly?
Thank you very much.




