Fix velocity conversion when using NAV_OFS_HDG

This commit is contained in:
Marek S. Łukasiewicz 2025-12-17 15:36:17 +01:00
parent 8e3b2934f3
commit 59c9c54e35

View file

@ -243,7 +243,12 @@ Transform3D MarshConnector::get_aircraft() {
return offset * marsh;
}
Vector3 MarshConnector::get_velocity() { return last_velocity; }
Vector3 MarshConnector::get_velocity() {
float heading_rad = parameters[NAV_OFS_HDG] * Math_PI / 180.0;
// To rotate clockwise looking from above, that's negative Y in Godot
Quaternion heading_offset = Quaternion(Vector3(0, 1, 0), -heading_rad);
return heading_offset.xform(last_velocity);
}
Vector2 MarshConnector::get_cyclic() {
return Vector2{last_controls.x, last_controls.y};