Fixed kart getting stuck at doors of overworld (and other static
physical objects).
This commit is contained in:
parent
e97c4858f3
commit
642a333e5e
@ -1778,6 +1778,8 @@ void Kart::crashed(AbstractKart *k, bool update_attachments)
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** Kart hits the track with a given material.
|
/** Kart hits the track with a given material.
|
||||||
* \param m Material hit, can be NULL if no specific material exists.
|
* \param m Material hit, can be NULL if no specific material exists.
|
||||||
|
* \param normal The normal of the hit (used to push a kart back, which avoids
|
||||||
|
* that karts sometimes can get stuck).
|
||||||
*/
|
*/
|
||||||
void Kart::crashed(const Material *m, const Vec3 &normal)
|
void Kart::crashed(const Material *m, const Vec3 &normal)
|
||||||
{
|
{
|
||||||
|
@ -594,10 +594,21 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
|
|||||||
upA, contact_manifold->getContactPoint(0).m_localPointA,
|
upA, contact_manifold->getContactPoint(0).m_localPointA,
|
||||||
upB, contact_manifold->getContactPoint(0).m_localPointB);
|
upB, contact_manifold->getContactPoint(0).m_localPointB);
|
||||||
else if(upB->is(UserPointer::UP_PHYSICAL_OBJECT))
|
else if(upB->is(UserPointer::UP_PHYSICAL_OBJECT))
|
||||||
|
{
|
||||||
// 2.3 kart hits physical object
|
// 2.3 kart hits physical object
|
||||||
m_all_collisions.push_back(
|
m_all_collisions.push_back(
|
||||||
upB, contact_manifold->getContactPoint(0).m_localPointB,
|
upB, contact_manifold->getContactPoint(0).m_localPointB,
|
||||||
upA, contact_manifold->getContactPoint(0).m_localPointA);
|
upA, contact_manifold->getContactPoint(0).m_localPointA);
|
||||||
|
// If the object is a statical object (e.g. a door in
|
||||||
|
// overworld) add a push back to avoid that karts get stuck
|
||||||
|
if (objB->isStaticObject())
|
||||||
|
{
|
||||||
|
AbstractKart *kart = upA->getPointerKart();
|
||||||
|
const btVector3 &normal = contact_manifold->getContactPoint(0)
|
||||||
|
.m_normalWorldOnB;
|
||||||
|
kart->crashed((Material*)NULL, normal);
|
||||||
|
} // isStatiObject
|
||||||
|
}
|
||||||
else if(upB->is(UserPointer::UP_ANIMATION))
|
else if(upB->is(UserPointer::UP_ANIMATION))
|
||||||
m_all_collisions.push_back(
|
m_all_collisions.push_back(
|
||||||
upB, contact_manifold->getContactPoint(0).m_localPointB,
|
upB, contact_manifold->getContactPoint(0).m_localPointB,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user