Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-10-20 14:51:44 +0000
committerStijn Buys <ingar@osirion.org>2013-10-20 14:51:44 +0000
commit4eedeb0bc1f40f6a67f609514f9732c8ec5a5c6d (patch)
tree92ee9ec979c72d487e3bf528eb7080f1c1b6e935
parentb277c65615482f17c966771341ae6b7a89cc9568 (diff)
Improved autopilot roll control in formation flight.
-rw-r--r--src/game/base/ship.cc17
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) {