Fixed bug 1879386 (homing missiles don't explode on track,

the rest was already fixed before).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1433 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-02-01 13:27:11 +00:00
parent e134102fb7
commit f59f487d8a
2 changed files with 10 additions and 5 deletions

View File

@ -106,7 +106,7 @@ void Flyable::createPhysics(float y_offset, const btVector3 velocity,
m_body->setLinearVelocity(v);
m_body->setAngularFactor(0.0f); // prevent rotations
}
// m_body->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
m_body->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
// FIXME: for now it is necessary to synch the graphical position with the
// physical position, since 'hot' computation is done using the

View File

@ -31,13 +31,18 @@ float Homing::m_st_max_turn_angle;
* own setting/getting of velocity, to be able to use flyables functions.
*/
Homing::Homing (Kart *kart) : Flyable(kart, COLLECT_HOMING)
{
m_mass = 0.0f; // a kinematik object must have mass=0, otherwise warnings
// will be printed during bullet collision handling.
{
// A bit of a hack: the mass of this kinematic object is still 1.0
// (see flyable), which enables collisions. I tried setting
// collisionFilterGroup/mask, but still couldn't get this object to
// collide with the track. By setting the mass to 1, collisions happen.
// (if bullet is compiled with _DEBUG, a warning will be printed the first
// time a homing-track collision happens).
float y_offset=kart->getKartLength()+2.0f*m_extend.getY();
m_initial_velocity = btVector3(0.0f, m_speed, 0.0f);
createPhysics(y_offset, m_initial_velocity, new btCylinderShape(0.5f*m_extend));
createPhysics(y_offset, m_initial_velocity,
new btCylinderShape(0.5f*m_extend));
m_body->setCollisionFlags(m_body->getCollisionFlags() |
btCollisionObject::CF_KINEMATIC_OBJECT );
m_body->setActivationState(DISABLE_DEACTIVATION);