29 lines
604 B
GDScript
29 lines
604 B
GDScript
extends Label
|
|
|
|
var boat: Boat # Assigned by hud
|
|
var world: WorldManager # Assigned by hud
|
|
|
|
func _process(_delta: float) -> void:
|
|
if boat == null or world == null:
|
|
text = "no boat"
|
|
return
|
|
|
|
var forward := -boat.global_basis.z
|
|
forward.y = 0.0
|
|
var speed := boat.linear_velocity.dot(forward.normalized())
|
|
var pos := world.true_position(boat)
|
|
|
|
text = "Desired Throttle: %+.0f %%
|
|
Actual Throttle: %+.0f %%
|
|
Speed: %.1f m/s
|
|
Submerged: %.0f %%
|
|
Position: (%.0f, %.0f)
|
|
" % [
|
|
boat.desired_throttle * 100.0,
|
|
boat.throttle * 100.0,
|
|
speed,
|
|
boat.submerged_ratio * 100.0,
|
|
pos.x,
|
|
pos.z,
|
|
]
|