summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2019-12-09 15:06:25 +0100
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2019-12-10 08:16:32 +0100
commite0d252311e4c35e08785de0cadd747daba59f747 (patch)
tree39c6b3c714c7725de8ce991b43577a0c79b980fe
parent16fc023d4487c2a3f26b5bdd3827628de2cd0ba2 (diff)
Add check for zero length motion at beginning of each sweep test loop
in SpaceBullet::test_body_motion.
-rw-r--r--modules/bullet/space_bullet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index d73930775d..a998311824 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -945,7 +945,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
btVector3 motion;
G_TO_B(p_motion, motion);
- if (!motion.fuzzyZero()) {
+ {
// Phase two - sweep test, from a secure position without margin
const int shape_count(p_body->get_shape_count());
@@ -960,7 +960,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
motionVec->end();
#endif
- for (int shIndex = 0; shIndex < shape_count; ++shIndex) {
+ for (int shIndex = 0; shIndex < shape_count && !motion.fuzzyZero(); ++shIndex) {
if (p_body->is_shape_disabled(shIndex)) {
continue;
}