3
votes

Im working on a project with libgdx, box2d, in Java.

This is what my program does :

_ when collision between 2 fixtures, set one of the fixture's Body as not 'Active'

   myBody.setActive(false);

Problem :

I noticed that I get a Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1) in the logcat when I put this line, probably because the inactive body is still in the ContactListener.

I just got 1 ContactListener class in my main program.

How to remove / add a Body to the ContactListener ? I don't know if this is the solution, but I guess, could you help me ? I don't know how to solve this.

1

1 Answers

4
votes

Thats because the contact handling in the listener ocurrs inside the world.step, and the world is blocked while its running.

You can add it to a list for example, for it to be set inactive once the world.step ends.