AC_WPNav: fix spline initialisation of terrain offset

This commit is contained in:
Randy Mackay 2021-04-27 20:21:05 +09:00
parent 361ba989bd
commit a3ceb6d95b

View File

@ -687,7 +687,8 @@ bool AC_WPNav::set_spline_destination(const Vector3f& destination, bool terrain_
// calculate origin and origin velocity vector
Vector3f origin_vector;
if (terrain_alt == _terrain_alt && _flags.fast_waypoint) {
if (terrain_alt == _terrain_alt) {
if (_flags.fast_waypoint) {
// calculate origin vector
if (_this_leg_is_spline) {
// if previous leg was a spline we can use destination velocity vector for origin velocity vector
@ -696,6 +697,7 @@ bool AC_WPNav::set_spline_destination(const Vector3f& destination, bool terrain_
// use direction of the previous straight line segment
origin_vector = _destination - _origin;
}
}
// use previous destination as origin
_origin = _destination;