Page MenuHome

BGE: Fix T43215: Rigidbody constraints deletion.
ClosedPublic

Authored by Thomas Szepe (hg1) on Jan 17 2015, 8:44 PM.

Diff Detail

Repository
rB Blender

Event Timeline

Thomas Szepe (hg1) retitled this revision from to BGE: Fix for T43215 introduces with D701..
Thomas Szepe (hg1) updated this object.

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.

Test file:

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

Thomas Szepe (hg1) edited edge metadata.

Fixed typo (m_ccdConstraintRefs)

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

Thomas Szepe (hg1) retitled this revision from BGE: Fix for T43215 introduces with D701. to BGE: Fix T43215: Rigidbody constraints deletion..Feb 19 2015, 12:06 PM
Thomas Szepe (hg1) updated this object.
Jorge Bernal (lordloki) edited edge metadata.
This revision is now accepted and ready to land.Feb 20 2015, 9:43 AM
Sybren A. Stüvel (sybren) edited edge metadata.

Looks good to me too.

This revision was automatically updated to reflect the committed changes.