Added Interact system with a raycast

This commit is contained in:
2024-06-03 23:39:36 -05:00
parent 1003bc186e
commit 9f76eacaad
5 changed files with 122 additions and 4 deletions

View File

@ -0,0 +1,17 @@
extends RayCast3D
@onready var prompt = $"Prompt"
# Called when the node enters the scene tree for the first time.
func _ready():
add_exception(owner)
func _physics_process(delta):
prompt.text = ""
if is_colliding():
var collider = get_collider()
if collider is Interactable:
prompt.text = "Press E"
if Input.is_action_just_pressed("interact"):
collider.interact(owner)