Version
Godot 3.5 (GDScript)
Issue
I’m making an interaction system (for example: open doors, disappear objects, etc.) and I want to make as if the character was doing those actions with his hands and for that I’m using an “Area” node to get the object’s methods and so I can do the desired actions, and I’ve found that I don’t know how to use correctly the “Area” node XD.
What i tried
here is the code:
extends Node
onready var interact_label = $"../UI_Debug/E"
onready var _input_node = $"../input_save_node"
func _on_Hands_area_body_entered(body: Node) -> void:
if body.has_method("interact"):
interact_label.visible = true
if _input_node.interact_action:
body.interact()
else:
interact_label.visible = false
print("a, ", body)
I realized that the mistake I am making is that I am using the _on_Hands_area_body_entered(body: Node)
signal as if it were a _process(delta)
and I also realized that I can’t call the function or assign the variable body
to another one, and I wanted to know if there was any other way to make the interactions as if the character was using his hands.
Oshiro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.