Added Night stand animation to open and close when interacted with and fixed interaction ray so I don't have to use classes and I can just have it use the intractable physics layer
This commit is contained in:
@ -10,7 +10,7 @@ func _physics_process(delta):
|
||||
prompt.text = ""
|
||||
if is_colliding():
|
||||
var collider = get_collider()
|
||||
if collider is Interactable:
|
||||
if collider:
|
||||
prompt.text = collider.promt_message
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
collider.interact(owner)
|
||||
|
||||
13
Assets/scripts/night_stand.gd
Normal file
13
Assets/scripts/night_stand.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends StaticBody3D
|
||||
|
||||
@export var promt_message:String = "press e"
|
||||
@export var promt_key:String
|
||||
var is_open = false
|
||||
|
||||
func interact(player):
|
||||
if not is_open:
|
||||
$AnimationPlayer.play("Open")
|
||||
is_open = true
|
||||
else:
|
||||
$AnimationPlayer.play("Close")
|
||||
is_open = false
|
||||
Reference in New Issue
Block a user