diff options
-rw-r--r-- | src/game/base/ship.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index c017ce1..5d8ace2 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -1217,13 +1217,18 @@ void Ship::frame_autopilot_formation(const unsigned long elapsed, core::Entity * } else { target_direction = 0.0f; target_pitch = 0.0f; + } - if (reference.up().z() < 0) { - // upward-down - target_roll = math::sgnf(reference.up().y()); - } else { - target_roll = reference.up().y(); - } + + if (reference.up().z() < 0.0f) { + // upward-down + target_roll = math::sgnf(reference.up().y()); + + } else if (reference.up().z() + MIN_DELTA < 1.0f) { + target_roll = reference.up().y(); + + } else { + target_roll = 0.0f; } if (target->type() == core::Entity::Controlable) { |