Fix velocity conversion when using NAV_OFS_HDG
This commit is contained in:
parent
8e3b2934f3
commit
59c9c54e35
1 changed files with 6 additions and 1 deletions
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue