cawez_puzzlebox/cubes/tile/tile_push.gd
2024-06-22 22:24:36 -04:00

14 lines
470 B
GDScript

extends Area3D
# Called when the node enters the scene tree for the first time.
func _ready():
body_entered.connect(_on_area_entered)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_area_entered(body : Node3D) -> void:
# Cubes cannot be pushed on tiles where the player cannot go!
if get_node("../raycast_ground").get_collider() != null:
get_parent_node_3d().buffer = quaternion * Vector3.DOWN * 3