Files
car-os/widgets/compass/scripts/compass_widget_node.gd
T

21 lines
470 B
GDScript

extends BaseWidgetNode
class_name CompassWidgetNode
@export_range(0., 359., 0.1) var north_deg = 0.
var north_rad: float
var indicator: Sprite2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
super._ready()
if north_deg == null:
north_deg = 0.
north_rad = deg_to_rad(north_deg)
indicator = get_node("CompassIndicator")
func _update_data():
if indicator == null:
return
indicator.rotation = host_vehicle.heading_rad