diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-20 20:08:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-20 20:08:09 +0100 |
commit | 674d805813f487575422f196f6114d80d83d00e6 (patch) | |
tree | 6ff886c4d18532fb4a2b5b08d47370a860f426bf | |
parent | 82ad05a20ef4420122b18eadf3835c4a8a49ba19 (diff) | |
parent | 5dac3e857fc349d2b33f53013381e32cf5ce3e1d (diff) |
Merge pull request #13106 from muiroc/btfixes
bullet cast_motion: reordered null check
-rw-r--r-- | modules/bullet/space_bullet.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index e4d049b00d..853906063b 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -175,13 +175,13 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, 0.002); - if (r_info) { - if (btResult.hasHit()) { + if (btResult.hasHit()) { + p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction; + if (r_info) { if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) { B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity); } CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer()); - p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction; B_TO_G(btResult.m_hitPointWorld, r_info->point); B_TO_G(btResult.m_hitNormalWorld, r_info->normal); r_info->rid = collision_object->get_self(); |