extends StaticBody3D @export var recursive = false var buffer = Vector3(0,0,0) @export var clear_buffer = true # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if (buffer != Vector3.ZERO): move(buffer) if clear_buffer: buffer = Vector3.ZERO func move(direction) -> bool: $raycast_wall.target_position = direction $raycast_wall.force_raycast_update() $raycast_recursive.target_position = direction $raycast_recursive.force_raycast_update() if !$raycast_wall.is_colliding(): translate(direction) return true if recursive && $raycast_recursive.is_colliding(): if ($raycast_recursive.get_collider().move(direction)): translate(direction) return true return false