first
This commit is contained in:
19
Maps/Spaceship/Objects/Grabable/GrabBox.gd
Normal file
19
Maps/Spaceship/Objects/Grabable/GrabBox.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
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
|
||||
Reference in New Issue
Block a user