From d6e4c4e7c2b1e28961f1dfe2f25ef96ced60b21b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 17 Oct 2010 17:19:03 +0000 Subject: core bullet physics support, initial vstrafe support --- src/game/base/ship.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/game/base/ship.cc') diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index a588122..d7d6b59 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -76,6 +76,8 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable( set_flag(core::Entity::Dockable); } + + set_mass(radius()); reset(); } @@ -89,7 +91,10 @@ void Ship::reset() current_target_pitch = 0.0f;; current_target_roll = 0.0f; current_target_strafe = 0.0f; + current_target_vstrafe = 0.0f; current_target_afterburner = 0.0f; + + EntityControlable::reset(); } // this is called if another shuo wants to dock this ship @@ -617,6 +622,16 @@ void Ship::frame(float seconds) if ((entity_movement > 0) || (entity_speed > 0)) { set_dirty(); } + + // transfer entity location to motion state + btTransform t; + t.setIdentity(); + t.setOrigin(math::to_btVector3(location())); + t.setBasis(math::to_btMatrix3x3(axis())); + entity_body->setWorldTransform(t); + + if (zone()) + zone()->physics()->synchronizeSingleMotionState(entity_body); } } // namespace game -- cgit v1.2.3