From 512c60f1d8cee4a66cc75b80af4be1902b52e54c Mon Sep 17 00:00:00 2001 From: AndreaCatania Date: Sat, 23 Dec 2017 00:04:53 +0100 Subject: [PATCH] Fixed intersect_shape crash, closes #13697 --- modules/bullet/godot_result_callbacks.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index cbf30c8a2e0..37e45cfff80 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -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) { + if (m_count >= m_resultMax) + return cp.getDistance(); + if (cp.getDistance() <= 0) { PhysicsDirectSpaceState::ShapeResult &result = m_results[m_count]; @@ -165,7 +168,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con ++m_count; } - return m_count < m_resultMax; + return cp.getDistance(); } bool GodotContactPairContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {