It's been a long ride

I've finally ported most of the engine (no joints). However, it's definitely not working, you can see from the testbed that I quickly hacked up that that things are NOT going correctly in the engine. So, if any of you have some free time, I'd definitely appreciate it if you could comb through my porting to look for errors. The common library should be fine, but other than that I'm not sure. I'm definitely having trouble spotting my errors though.

A few differences from box2d (rev 100):
[*] The DynamicTree is completely different, it's still a dynamic tree but proxys are the actual tree objects and the tree operations are recursive.
[*] I put a bunch of the struct in the struct package, where I was going to sort out what should go where later
[*] Alot is done to pool objects. This may in fact be the reason for errors, but I've tried to unpool things and it doesn't help.

It's probably just one or two small errors that cause tons of problems. Any help is appreciated 🙂
Starting from which revision should we look?
The lastest revision on the google code page https://code.google.com/p/jbox2d/, in the updating folder. It's a maven project, you can check out the jbox2d-library module for the library and the jbox2d-textbed module for the testbed. Thanks 🙂
It looks very good and promising. Will start experiment with this later today if I find the time.

A note about the maven structure: There are duplicate maven artifactIds. Both the main pom and the one inside box2d-library have the artifact id: "box2d". Either, name the parent as "box2d-main" (or -paren or something) or add -library to the child. Best to update the module names to reflect this.

I love maven! 🙂
Now I can just install it into my private repo and use it for all my projects with 10x less fuss.
Sorry about that... the artifactIds were fine... it's just the name 😳
Yes, maven integration is great, I'm gonna put it in the central repo once we get things working. Here are the problems that I can't find right now:

* position correction looks like it's going the opposite way it should, maybe a negative sign in there that shouldn't be.
* TOI sort-of works, sometimes.

If anyone wants to take a look.
WAPOW! fixed the position correction error! I'll start making more tests.

edit: still things going wrong, but they're not as bad

Here's an image of a test working, I added the ability to draw the dynamic tree, which is pretty cool:
Image
So the project is slowly becoming more functional, with some more tests in there. The domino test has a funny result, the ones falling left fall perfectly, but the ones falling right go into eachother and cause a big mess haha. I have no idea why this is happening, but it looks pretty funny. Also, gravity doesn't seem to work when I'm holding an object with a mouse joint...
I made this little test:

Code:
package org.jbox2d.testbed.tests;

import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.collision.shapes.Shape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.BodyDef;
import org.jbox2d.dynamics.BodyType;
import org.jbox2d.testbed.framework.TestbedTest;

public class CoupleOfThingsTest extends TestbedTest {
   
   @Override
   public void initTest() {
      setTitle("Couple of Things Test");
      
      world.setGravity(new Vec2());

      for (int i = 0; i < 2; i++)
      {
//         CircleShape circleShape = new CircleShape();
//         circleShape.m_radius = 1;
//         Shape shape = circleShape;
         PolygonShape polygonShape = new PolygonShape();
         polygonShape.setAsBox(1, 1);
         Shape shape = polygonShape;

         BodyDef bodyDef = new BodyDef();
         bodyDef.type = BodyType.DYNAMIC;
         bodyDef.position.set(5 * i, 0);
         bodyDef.angle = (float) (Math.PI / 4 * i);
         bodyDef.allowSleep = false;
         Body body = world.createBody(bodyDef);
         body.createFixture(shape, 5.0f);
         
         body.applyForce(new Vec2(-10000 * (i - 1), 0), new Vec2());
      }
   }

   /**
    * @see org.jbox2d.testbed.framework.TestbedTest#getTestName()
    */
   @Override
   public String getTestName() {
      return "Couple of Things";
   }
}


I noticed that the bodies collided nicely when I put my test at the start of the test list and started the program. But if I then selected a different test from the combo box, and then selected my test again, the bodies would interpenetrate before colliding, as the dominos in the domino test sometimes do.

With such a simple test case, maybe you can catch the problem in the debugger, or with println() or something....
That's very strange behavior indeed... It even happens when you create a new test instance very time...

Edit: figured it out, something weird happens when I pool the collision object

Edit 2: alright, that's all fixed, and I also added the ability to turn off pooling for debugging. Thanks for pointing me in the right direction MJW!

Original thread: https://box2d.org/forum/viewtopic.php?t=5320