forked from unfa/liblast
20 lines
468 B
GDScript
20 lines
468 B
GDScript
|
extends Node3D
|
||
|
|
||
|
const SPEED = 200
|
||
|
|
||
|
# Declare member variables here. Examples:
|
||
|
# var a = 2
|
||
|
# var b = "text"
|
||
|
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
translate_object_local(Vector3.UP * SPEED / 60 * randf_range(0, 1)) # randomize starting point
|
||
|
$RayCast3D.target_position = Vector3.UP * SPEED / 60
|
||
|
|
||
|
func _process(delta):
|
||
|
if $RayCast3D.is_colliding():
|
||
|
queue_free()
|
||
|
else:
|
||
|
translate_object_local(Vector3.UP * SPEED * delta)
|