Skip to content

Commit a285ab6

Browse files
committed
Fix crash when calling move_and_collide with a null jolt_body
1 parent 9283328 commit a285ab6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/jolt_physics/spaces/jolt_physics_direct_space_state_3d.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,10 @@ Vector3 JoltPhysicsDirectSpaceState3D::get_closest_point_to_object_volume(RID p_
861861
bool JoltPhysicsDirectSpaceState3D::body_test_motion(const JoltBody3D &p_body, const PhysicsServer3D::MotionParameters &p_parameters, PhysicsServer3D::MotionResult *r_result) const {
862862
ERR_FAIL_COND_V_MSG(space->is_stepping(), false, "body_test_motion (maybe from move_and_slide?) must not be called while the physics space is being stepped.");
863863

864+
if (!p_body.in_space()) {
865+
return false;
866+
}
867+
864868
space->flush_pending_objects();
865869

866870
const float margin = MAX((float)p_parameters.margin, 0.0001f);

0 commit comments

Comments
 (0)