merge
This commit is contained in:
commit
c0455a3cb4
9 changed files with 59 additions and 63 deletions
|
@ -5,9 +5,10 @@ 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
|
||||
if Engine.is_editor_hint():
|
||||
camera = EditorInterface.get_editor_viewport_3d().get_camera_3d()
|
||||
var rotation_to_camera = -vec3_to_vec2(global_transform.basis.z).angle_to(vec3_to_vec2(camera.global_position)) + PI
|
||||
var chosen_index = 0
|
||||
for i in rotations.keys():
|
||||
if abs(rotation_to_camera-i) < abs(rotation_to_camera-chosen_index):
|
||||
|
@ -19,5 +20,8 @@ func _process(delta: float) -> void:
|
|||
|
||||
func entry_generator():
|
||||
rotations.clear()
|
||||
for i in range(rotation_count):
|
||||
for i in range(rotation_count+1):
|
||||
rotations[TAU/rotation_count*i] = Texture2D.new()
|
||||
|
||||
func vec3_to_vec2(vector : Vector3) -> Vector2:
|
||||
return Vector2(vector.x,vector.z).normalized()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue