14 lines
436 B
GDScript
14 lines
436 B
GDScript
extends Area3D
|
|
|
|
@export var needs_ground = true
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
body_entered.connect(_on_area_entered)
|
|
|
|
|
|
func _on_area_entered(_body : Node3D) -> void:
|
|
# Cubes cannot be pushed on tiles where the player cannot go!
|
|
if !needs_ground || (needs_ground && get_node("../raycast_ground").get_collider() != null):
|
|
get_parent_node_3d().buffer = quaternion * Vector3.DOWN * 3
|