19 lines
480 B
GDScript
19 lines
480 B
GDScript
extends BaseWidgetNode
|
|||
|
|
|
||
|
|
class_name PitchWidgetNode
|
||
|
|
|
||
|
|
var sprite: Sprite2D
|
||
|
|
var label: Label
|
||
|
|
|
||
|
|
|
||
|
|
# Called when the node enters the scene tree for the first time.
|
||
|
|
func _ready() -> void:
|
||
|
|
SensorSignals.pitch_updated.connect(_on_pitch_updated)
|
||
|
|
sprite = get_node("Sprite2D")
|
||
|
|
label = get_node("Label")
|
||
|
|
var label_size = label.size
|
||
|
|
|
||
|
|
func _on_pitch_updated(sensor_ip: String, pitch_rad: float):
|
||
|
|
sprite.rotation = pitch_rad
|
||
|
|
label.text = str(round(rad_to_deg(pitch_rad)*10)/10) + " \u00B0"
|