One year ago I made a post (viewtopic.php?f=3&t=312) about the engine getting randomly stuck at world.step, because of that problem I had to switch to libgdx-box2d.
Now, I'm making a new game, and I decided to use dyn4j because I really like it, among other advantages, but the problem happened again.
This new game was made from scratch. This time I've decided to find a solution as I don't want to switch engines.
In the old post, I found out that the engine was getting stuck at:
// after all has been updated find new contacts
// this is done so that the user has the latest contacts
// and the broadphase has the latest AABBs, etc.
this.detect();
This time it gets stuck at the same method, so I added prints inside it to see where exactly it happens, and when it finally crashed again, this was the result (got stuck on the red line):
// get their transforms
Transform transform1 = body1.getTransform();
Transform transform2 = body2.getTransform();
Convex convex2 = fixture2.getShape();
Convex convex1 = fixture1.getShape();
Penetration penetration = new Penetration();
// test the two convex shapes
System.out.print("a");
if (this.narrowphaseDetector.detect(convex1, transform1, convex2, transform2, penetration)) {
// check for zero penetration
System.out.print("b");
I'll continue trying to find the cause. Meanwhile, if anyone can help me, I'd be greatly pleased.
Thanks in advance.
PS: All the code is on World.java (org.dyn4j.dynamics.World)
PS2: I'm using all the default world settings except for gravity. Maybe I should try using another implementation of Narrowphase, given that it gets stuck at narrowphase.detect
UPDATE: I'll try using SAT instead of the default GJK, and if the problem happens again, I'll start checking where on narrowphase.detect it gets stuck.