17 lines
656 B
GDScript
17 lines
656 B
GDScript
extends RayCast3D
|
|
|
|
func _process(_delta: float) -> void:
|
|
#Keeps raycast from trying to detect objects that being queue freed
|
|
if get_collider() != null:
|
|
#Get collision object that raycast is hitting
|
|
var collider = get_collider()
|
|
#If the raycast is colliding with the object and the object is interactable
|
|
if is_colliding() and collider.is_in_group("interactable"):
|
|
|
|
if collider.has_method("interact") and Input.is_action_just_pressed("interact"):
|
|
collider.interact()
|
|
|
|
##code for detecting a label and displaying it if it exists
|
|
#if collider.find_child("InteractLabel") != null:
|
|
#collider.find_child("InteractLabel").show()
|