1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Visual/Physics/Navigation Servers validate RIDs with documentation update

This commit is contained in:
Cory Petkovsek
2021-12-09 22:16:46 +08:00
committed by Cory
parent c3065e2186
commit 2be0738304
10 changed files with 58 additions and 9 deletions

View File

@@ -1480,6 +1480,11 @@ bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis
}
void BulletPhysicsServer::free(RID p_rid) {
if (!p_rid.is_valid()) {
ERR_FAIL_MSG("Invalid RID.");
return;
}
if (shape_owner.owns(p_rid)) {
ShapeBullet *shape = shape_owner.get(p_rid);
@@ -1490,6 +1495,7 @@ void BulletPhysicsServer::free(RID p_rid) {
shape_owner.free(p_rid);
bulletdelete(shape);
} else if (rigid_body_owner.owns(p_rid)) {
RigidBodyBullet *body = rigid_body_owner.get(p_rid);
@@ -1532,8 +1538,9 @@ void BulletPhysicsServer::free(RID p_rid) {
space_set_active(p_rid, false);
space_owner.free(p_rid);
bulletdelete(space);
} else {
ERR_FAIL_MSG("Invalid ID.");
ERR_FAIL_MSG("Invalid RID.");
}
}