You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
609 B
16 lines
609 B
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)
|
|
|