Skip to content

Commit e0d2523

Browse files
committed
Add check for zero length motion at beginning of each sweep test loop
in SpaceBullet::test_body_motion.
1 parent 16fc023 commit e0d2523

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

modules/bullet/space_bullet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
945945

946946
btVector3 motion;
947947
G_TO_B(p_motion, motion);
948-
if (!motion.fuzzyZero()) {
948+
{
949949
// Phase two - sweep test, from a secure position without margin
950950

951951
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
960960
motionVec->end();
961961
#endif
962962

963-
for (int shIndex = 0; shIndex < shape_count; ++shIndex) {
963+
for (int shIndex = 0; shIndex < shape_count && !motion.fuzzyZero(); ++shIndex) {
964964
if (p_body->is_shape_disabled(shIndex)) {
965965
continue;
966966
}

0 commit comments

Comments
 (0)