Deleting an object was deleting all rigidbody constraints in the scene.
Bug was introduced with D701.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
I have added two patches, because I'm unsure if the first one is good enough.
The first patch only deletes the constraint if the associated main rigid body will be deleted.
The patch also wakes up the physic from the target object.
The second patch also deletes the constraint if the associated target object is deleted.
So this patch will work also with constraints that are done in the reverse order (Test file Cube 5 and 6) .
The patch can also wake up the physic from the main object.
If the reactivation from the sleeping state is not wanted please leave a comment.
@Angus Hollands (agoose77) @Sergej Reich (sergof)
Either of you know anything about Bullet constraints?
For me, with the first approach the uploaded examples crashes yet. The second one works like a charm.
Reviewing more in deep the code it seems that when a constraint is added, bullet adds a constraint reference only in the case that we have activated the "disableCollisionBetweenLinkedBodies".
Moreover, it seems that bullet uses these references as a way to set up the collision between linked bodies.
Due to this, the second solution seems to me a good system to get an "external to bullet" constraint reference count.
| source/gameengine/Physics/Bullet/CcdPhysicsController.h | ||
|---|---|---|
| 464 | Maybe, it would be better to use m_ccdConstraintRefs to follow the variable convention in the file | |
I missed two m_ccdConstraintRefs.
I also uploaded a Blender 32 bit test build.
http://www.mediafire.com/download/opjq8xze83iuq1o/Blender_2.73_constraints.zip