23 lines
720 B
GDScript
23 lines
720 B
GDScript
@tool
|
|
extends Sprite3D
|
|
|
|
|
|
@export var rotations : Dictionary[float,Texture2D]
|
|
|
|
func _process(delta: float) -> void:
|
|
if Engine.is_editor_hint(): return
|
|
var camera = get_viewport().get_camera_3d()
|
|
var rotation_to_camera = global_transform.basis.z.signed_angle_to(camera.global_position,Vector3.UP) + PI
|
|
var chosen_index = 0
|
|
for i in rotations.keys():
|
|
if abs(rotation_to_camera-i) < abs(rotation_to_camera-chosen_index):
|
|
chosen_index = i
|
|
texture = rotations[chosen_index]
|
|
|
|
@export_tool_button("Generate entries") var generator = entry_generator
|
|
@export var rotation_count : float = 8
|
|
|
|
func entry_generator():
|
|
rotations.clear()
|
|
for i in range(rotation_count):
|
|
rotations[TAU/rotation_count*i] = Texture2D.new()
|