Fixed intersect_shape crash, closes #13697

This commit is contained in:
AndreaCatania 2017-12-23 00:04:53 +01:00
parent 8d13753e91
commit 512c60f1d8

View File

@ -142,6 +142,9 @@ bool GodotAllContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) co
btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1) { btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1) {
if (m_count >= m_resultMax)
return cp.getDistance();
if (cp.getDistance() <= 0) { if (cp.getDistance() <= 0) {
PhysicsDirectSpaceState::ShapeResult &result = m_results[m_count]; PhysicsDirectSpaceState::ShapeResult &result = m_results[m_count];
@ -165,7 +168,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
++m_count; ++m_count;
} }
return m_count < m_resultMax; return cp.getDistance();
} }
bool GodotContactPairContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const { bool GodotContactPairContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {