From 47ebf96de47de4ae66cdc0ddf8f72a95ef8dd49d Mon Sep 17 00:00:00 2001 From: HG1 Date: Tue, 2 Dec 2014 19:25:06 -0800 Subject: [PATCH] BGE: Fix Rigid body constraint deletion Fix for T41294. Rigid body constraints are not deleted, if the corresponding game objects are deleted. Reviewers: moguri Differential Revision: https://developer.blender.org/D701 --- source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index e17d4402556..38e7df6c573 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -504,9 +504,9 @@ bool CcdPhysicsEnvironment::RemoveCcdPhysicsController(CcdPhysicsController* ctr btRigidBody* body = ctrl->GetRigidBody(); if (body) { - for (int i=body->getNumConstraintRefs()-1;i>=0;i--) + for (int i = m_dynamicsWorld->getNumConstraints()-1;i>=0;i--) { - btTypedConstraint* con = body->getConstraintRef(i); + btTypedConstraint *con = m_dynamicsWorld->getConstraint(i); m_dynamicsWorld->removeConstraint(con); body->removeConstraintRef(con); //delete con; //might be kept by python KX_ConstraintWrapper