You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Only remove Bullet's body constraints when removing body from space
This commit is contained in:
@@ -322,7 +322,8 @@ void RigidBodyBullet::set_space(SpaceBullet *p_space) {
|
||||
if (space) {
|
||||
can_integrate_forces = false;
|
||||
isScratchedSpaceOverrideModificator = false;
|
||||
|
||||
// Remove any constraints
|
||||
space->remove_rigid_body_constraints(this);
|
||||
// Remove this object form the physics world
|
||||
space->remove_rigid_body(this);
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ void SpaceBullet::add_rigid_body(RigidBodyBullet *p_body) {
|
||||
}
|
||||
}
|
||||
|
||||
void SpaceBullet::remove_rigid_body(RigidBodyBullet *p_body) {
|
||||
void SpaceBullet::remove_rigid_body_constraints(RigidBodyBullet *p_body) {
|
||||
btRigidBody *btBody = p_body->get_bt_rigid_body();
|
||||
|
||||
int constraints = btBody->getNumConstraintRefs();
|
||||
@@ -487,6 +487,10 @@ void SpaceBullet::remove_rigid_body(RigidBodyBullet *p_body) {
|
||||
dynamicsWorld->removeConstraint(btBody->getConstraintRef(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpaceBullet::remove_rigid_body(RigidBodyBullet *p_body) {
|
||||
btRigidBody *btBody = p_body->get_bt_rigid_body();
|
||||
|
||||
if (p_body->is_static()) {
|
||||
dynamicsWorld->removeCollisionObject(btBody);
|
||||
|
||||
@@ -151,6 +151,7 @@ public:
|
||||
void reload_collision_filters(AreaBullet *p_area);
|
||||
|
||||
void add_rigid_body(RigidBodyBullet *p_body);
|
||||
void remove_rigid_body_constraints(RigidBodyBullet *p_body);
|
||||
void remove_rigid_body(RigidBodyBullet *p_body);
|
||||
void reload_collision_filters(RigidBodyBullet *p_body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user