Restoring Collisions after joint removal

Feb 16, 2011 at 4:19 AM
Edited Feb 16, 2011 at 4:19 AM

Hi

So im using the following code to remove a weld joint from my fixtures:

 

 

if (input.RMouseButtonPressed)
{ 
   world.JointList.Remove(testModule.getFixture().Body.JointList.Joint);
}

 

The problem is that after the joint has been removed the fixtures no longer interact with each-other.

Is there some way to restore collisions between to objects that have had the weld joint removed?

I have tried using:

 

testModule.getFixture().CollisionFilter.RestoreCollisionWith(ship.getFixture());

but to no avail.

 

Thanks.

Coordinator
Feb 16, 2011 at 3:51 PM

Don't remove the body from the JointList. Use World.RemoveJoint() instead.

Feb 16, 2011 at 4:23 PM

Thanks for the response.

I tried using that before. and I get a Null Reference exception when I use this line:

world.RemoveJoint(testModule.getFixture().Body.JointList.Joint);

Is there a better way to access the joint?

Thanks

 

Coordinator
Feb 16, 2011 at 4:31 PM

When you create the joint, store a reference too it in the class that creates it. What you are doing is not going to work.