stick-the-quick/startup/TitleScreenIcosahedron.gd

31 lines
959 B
GDScript3
Raw Normal View History

class_name TitleScreenIcosahedron extends Node3D
var _aspeed := Vector3.ZERO
var _x_aspeed := Vector3.ZERO
var _y_aspeed := Vector3.ZERO
var _z_aspeed := Vector3.ZERO
@onready var _icosahedron := $'Icosahedron' as Node3D
@onready var _x_gimbal := $'XGimbal' as Node3D
@onready var _y_gimbal := $'YGimbal' as Node3D
@onready var _z_gimbal := $'ZGimbal' as Node3D
func _rand_aaccel_component() -> float:
return (randf() - 0.5)*0.001
func _rand_adjust_aspeed(vec: Vector3) -> Vector3:
return (vec + Vector3(
_rand_aaccel_component(),
_rand_aaccel_component(),
_rand_aaccel_component()
)).limit_length(0.1)
func _process(_delta: float) -> void:
_aspeed = _rand_adjust_aspeed(_aspeed)
_x_aspeed = _rand_adjust_aspeed(_x_aspeed)
_y_aspeed = _rand_adjust_aspeed(_y_aspeed)
_z_aspeed = _rand_adjust_aspeed(_z_aspeed)
_icosahedron.rotation += _aspeed
_x_gimbal.rotation += _x_aspeed
_y_gimbal.rotation += _y_aspeed
_z_gimbal.rotation += _z_aspeed