20 lines
544 B
Plaintext
20 lines
544 B
Plaintext
extends Area3D
|
|
class_name GrabBox
|
|
|
|
signal grabbedByPlayer
|
|
@export var obj: GrabableObject
|
|
@export var type: String #Used to signify the type of Object for other code interacting with the grab box
|
|
@export var heavy: bool = false
|
|
|
|
func _ready() -> void:
|
|
set_collision_layer_value(5,true) #Enables Grabing colision layer
|
|
set_collision_layer_value(1,false) #Disables Default collision layer
|
|
set_collision_mask_value(1,false)
|
|
|
|
func grab() -> GrabableObject:
|
|
if !obj: return
|
|
if !obj.isGrabbed:
|
|
grabbedByPlayer.emit()
|
|
return obj
|
|
return null
|