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:
parent
47e10c862d
commit
792b246c0c
@ -68,7 +68,7 @@ Flyable::Flyable(Kart *kart, PowerupType type, float mass) : Moveable()
|
|||||||
} // Flyable
|
} // Flyable
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void Flyable::createPhysics(float y_offset, const btVector3 velocity,
|
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)
|
const bool rotates, const bool turn_around, const btTransform* customDirection)
|
||||||
{
|
{
|
||||||
// Get Kart heading direction
|
// Get Kart heading direction
|
||||||
@ -97,8 +97,7 @@ void Flyable::createPhysics(float y_offset, const btVector3 velocity,
|
|||||||
m_user_pointer.set(this);
|
m_user_pointer.set(this);
|
||||||
RaceManager::getWorld()->getPhysics()->addBody(getBody());
|
RaceManager::getWorld()->getPhysics()->addBody(getBody());
|
||||||
|
|
||||||
if(gravity) m_body->setGravity(btVector3(0.0f, 0.0f, -9.8f));
|
m_body->setGravity(btVector3(0.0f, 0.0f, gravity));
|
||||||
else m_body->setGravity(btVector3(0.0f, 0.0f, 0.0f));
|
|
||||||
|
|
||||||
// Rotate velocity to point in the right direction
|
// Rotate velocity to point in the right direction
|
||||||
btVector3 v=trans.getBasis()*velocity;
|
btVector3 v=trans.getBasis()*velocity;
|
||||||
|
@ -84,7 +84,7 @@ protected:
|
|||||||
/** init bullet for moving objects like projectiles */
|
/** init bullet for moving objects like projectiles */
|
||||||
void createPhysics(float y_offset,
|
void createPhysics(float y_offset,
|
||||||
const btVector3 velocity,
|
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 bool rotates=false, const bool turn_around=false,
|
||||||
const btTransform* customDirection=NULL);
|
const btTransform* customDirection=NULL);
|
||||||
public:
|
public:
|
||||||
|
@ -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),
|
createPhysics(y_offset, btVector3(0.0f, m_speed*2, 0.0f),
|
||||||
new btSphereShape(0.5f*m_extend.getY()),
|
new btSphereShape(0.5f*m_extend.getY()),
|
||||||
true /*gravity*/,
|
-20.0f /*gravity*/,
|
||||||
true /*rotates*/);
|
true /*rotates*/);
|
||||||
|
|
||||||
// Do not adjust the z velociy depending on height above terrain, since
|
// Do not adjust the z velociy depending on height above terrain, since
|
||||||
|
@ -90,7 +90,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
|
|||||||
m_initial_velocity = btVector3(0.0f, m_speed, up_velocity);
|
m_initial_velocity = btVector3(0.0f, m_speed, up_velocity);
|
||||||
|
|
||||||
createPhysics(y_offset, m_initial_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);
|
true /* rotation */, false /* backwards */, &trans);
|
||||||
|
|
||||||
m_body->setActivationState(DISABLE_DEACTIVATION);
|
m_body->setActivationState(DISABLE_DEACTIVATION);
|
||||||
|
@ -34,7 +34,7 @@ Plunger::Plunger(Kart *kart) : Flyable(kart, POWERUP_PLUNGER)
|
|||||||
const bool reverse_mode = (pk != NULL && pk->getCamera()->getMode() == Camera::CM_REVERSE);
|
const bool reverse_mode = (pk != NULL && pk->getCamera()->getMode() == Camera::CM_REVERSE);
|
||||||
|
|
||||||
createPhysics(y_offset, btVector3(0.0f, m_speed*2, 0.0f),
|
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 = new RubberBand(this, *kart);
|
||||||
m_rubber_band->ref();
|
m_rubber_band->ref();
|
||||||
} // Plunger
|
} // Plunger
|
||||||
|
Loading…
x
Reference in New Issue
Block a user