pretty happy with hud minimap
This commit is contained in:
27
scripts/wiggle_platform_1.gd
Normal file
27
scripts/wiggle_platform_1.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node3D
|
||||
|
||||
@export var wiggle_amount : Vector3 = Vector3(3,3,3)
|
||||
@export var move_speed : float = 1.0
|
||||
|
||||
var start_position
|
||||
var wiggle_point
|
||||
|
||||
func _ready() -> void:
|
||||
start_position = global_position
|
||||
get_random_wiggle_pos()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
move_to_wiggle_point(delta)
|
||||
|
||||
func get_random_wiggle_pos():
|
||||
var x = randf_range(-wiggle_amount.x,wiggle_amount.x)
|
||||
var y = randf_range(-wiggle_amount.y,wiggle_amount.y)
|
||||
var z = randf_range(-wiggle_amount.z,wiggle_amount.z)
|
||||
|
||||
wiggle_point = Vector3(x,y,z) + start_position
|
||||
|
||||
func move_to_wiggle_point(delta):
|
||||
if global_position.distance_to(wiggle_point) < .1:
|
||||
get_random_wiggle_pos()
|
||||
else:
|
||||
global_position = lerp(global_position,wiggle_point,delta * move_speed)
|
||||
Reference in New Issue
Block a user