Change how different sensor types ar handled

This commit is contained in:
2026-07-06 13:57:09 -06:00
parent 6eb2993391
commit 8fc5088c01
21 changed files with 320 additions and 124 deletions
+26 -2
View File
@@ -5,6 +5,7 @@ class_name CompassWidgetNode
@export_range(0., 359., 0.1) var north_deg = 0.
var north_rad: float
var indicator: Sprite2D
var label: Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@@ -13,8 +14,31 @@ func _ready() -> void:
north_deg = 0.
north_rad = deg_to_rad(north_deg)
indicator = get_node("CompassIndicator")
label = get_node("Label")
func _update_data():
if indicator == null:
if label == null:
return
indicator.rotation = host_vehicle.heading_rad
#label.rotation = -host_vehicle.heading_rad
label.text = get_direction_label(host_vehicle.heading_rad)
func get_direction_label(heading_rad):
var heading_deg = rad_to_deg(heading_rad)
if 0 <= heading_deg and heading_deg <= 22.5:
return 'N'
elif 22.5 < heading_deg and heading_deg <= 67.5:
return "NE"
elif 67.5 < heading_deg and heading_deg <= 112.5:
return "E"
elif 112.5 < heading_deg and heading_deg <= 157.5:
return "SE"
elif 157.5 < heading_deg and heading_deg <= 202.5:
return "S"
elif 202.5 < heading_deg and heading_deg <= 247.5:
return "SW"
elif 247.5 < heading_deg and heading_deg <= 292.5:
return "W"
elif 292.5 < heading_deg and heading_deg <= 337.5:
return "NW"
else:
return "N"