extends AnimatedSprite3D # Because billboard sprites don't support rotation of any sort, this # "simulates" that by using `look_at` to point it towards the camera. # Uses the initial rotation's Z value for the rotation value. # Also rotates 180° because otherwise the sprite appears mirrored? @onready var rotation_z := self.rotation.z func _process(_delta: float) -> void: var camera := get_viewport().get_camera_3d() var look_pos := camera.global_position look_at(look_pos, camera.global_transform.basis.y) rotate_object_local(Vector3.FORWARD, rotation_z) rotate_object_local(Vector3.UP, TAU / 2)