Added null check in Bullet cast_motion API
This commit is contained in:
parent
d250ade37b
commit
0327a51c12
@ -175,6 +175,7 @@ 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 (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);
|
||||
@ -187,6 +188,7 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
|
||||
r_info->collider_id = collision_object->get_instance_id();
|
||||
r_info->shape = btResult.m_shapeId;
|
||||
}
|
||||
}
|
||||
|
||||
bulletdelete(bt_convex_shape);
|
||||
return btResult.hasHit();
|
||||
|
Loading…
Reference in New Issue
Block a user