made bowling ball less jumpy by putting more gravity on it

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2567 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-12-03 16:38:09 +00:00
parent 47e10c862d
commit 792b246c0c
5 changed files with 6 additions and 7 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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

View File

@ -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);

View File

@ -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