summaryrefslogtreecommitdiff
path: root/modules/bullet
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-10 17:53:44 +0100
committerGitHub <noreply@github.com>2021-11-10 17:53:44 +0100
commitc5a99a205653987e3c761cf34ad4a74fcfeb0fd4 (patch)
treeb95b22c83423f51cbc218c47b32beeebbf158ca4 /modules/bullet
parent9b6897307cec9465c11ad522a9e21c8923c2c189 (diff)
parentbfd0d33244f565ffca17b0578edc3a82b76a7204 (diff)
Merge pull request #54820 from nekomatata/fix-character-body-floor-errors
Diffstat (limited to 'modules/bullet')
-rw-r--r--modules/bullet/bullet_physics_server.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 610d2145cd..684a20cf4d 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -837,8 +837,17 @@ void BulletPhysicsServer3D::body_set_ray_pickable(RID p_body, bool p_enable) {
}
PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) {
+ if (!rigid_body_owner.owns(p_body)) {
+ return nullptr;
+ }
+
RigidBodyBullet *body = rigid_body_owner.get_or_null(p_body);
ERR_FAIL_COND_V(!body, nullptr);
+
+ if (!body->get_space()) {
+ return nullptr;
+ }
+
return BulletPhysicsDirectBodyState3D::get_singleton(body);
}