diff --git a/src/flyable.cpp b/src/flyable.cpp index 03371ff37..456e6a4a9 100644 --- a/src/flyable.cpp +++ b/src/flyable.cpp @@ -68,7 +68,7 @@ Flyable::Flyable(Kart *kart, PowerupType type, float mass) : Moveable() } // Flyable // ---------------------------------------------------------------------------- void Flyable::createPhysics(float y_offset, const btVector3 velocity, - btCollisionShape *shape, const bool gravity, + btCollisionShape *shape, const float gravity, const bool rotates, const bool turn_around, const btTransform* customDirection) { // Get Kart heading direction @@ -97,8 +97,7 @@ void Flyable::createPhysics(float y_offset, const btVector3 velocity, m_user_pointer.set(this); RaceManager::getWorld()->getPhysics()->addBody(getBody()); - if(gravity) m_body->setGravity(btVector3(0.0f, 0.0f, -9.8f)); - else m_body->setGravity(btVector3(0.0f, 0.0f, 0.0f)); + m_body->setGravity(btVector3(0.0f, 0.0f, gravity)); // Rotate velocity to point in the right direction btVector3 v=trans.getBasis()*velocity; diff --git a/src/flyable.hpp b/src/flyable.hpp index 82a91e987..be6bb0121 100644 --- a/src/flyable.hpp +++ b/src/flyable.hpp @@ -84,7 +84,7 @@ protected: /** init bullet for moving objects like projectiles */ void createPhysics(float y_offset, const btVector3 velocity, - btCollisionShape *shape, const bool gravity=false, + btCollisionShape *shape, const float gravity=0.0f, const bool rotates=false, const bool turn_around=false, const btTransform* customDirection=NULL); public: diff --git a/src/items/bowling.cpp b/src/items/bowling.cpp index 99a646475..813509141 100644 --- a/src/items/bowling.cpp +++ b/src/items/bowling.cpp @@ -48,7 +48,7 @@ Bowling::Bowling(Kart *kart) : Flyable(kart, POWERUP_BOWLING, 50.0f /* mass */) createPhysics(y_offset, btVector3(0.0f, m_speed*2, 0.0f), new btSphereShape(0.5f*m_extend.getY()), - true /*gravity*/, + -20.0f /*gravity*/, true /*rotates*/); // Do not adjust the z velociy depending on height above terrain, since diff --git a/src/items/cake.cpp b/src/items/cake.cpp index ba57c148f..aab04362c 100644 --- a/src/items/cake.cpp +++ b/src/items/cake.cpp @@ -90,7 +90,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE) m_initial_velocity = btVector3(0.0f, m_speed, up_velocity); createPhysics(y_offset, m_initial_velocity, - new btCylinderShape(0.5f*m_extend), true /* gravity */, + new btCylinderShape(0.5f*m_extend), -9.8f /* gravity */, true /* rotation */, false /* backwards */, &trans); m_body->setActivationState(DISABLE_DEACTIVATION); diff --git a/src/items/plunger.cpp b/src/items/plunger.cpp index 7fe69e75e..28c7fd44a 100644 --- a/src/items/plunger.cpp +++ b/src/items/plunger.cpp @@ -34,7 +34,7 @@ Plunger::Plunger(Kart *kart) : Flyable(kart, POWERUP_PLUNGER) const bool reverse_mode = (pk != NULL && pk->getCamera()->getMode() == Camera::CM_REVERSE); createPhysics(y_offset, btVector3(0.0f, m_speed*2, 0.0f), - new btCylinderShape(0.5f*m_extend), false, false, reverse_mode ); + new btCylinderShape(0.5f*m_extend), 0.0f /* gravity */, false /* rotates */, reverse_mode ); m_rubber_band = new RubberBand(this, *kart); m_rubber_band->ref(); } // Plunger