Search code examples
box2dprocessingjbox2d

Box2D blocks wobbling/jittering/vibrating


I have a stack of blocks in my Box2D simulation (in Processing, using the Fisica wrapper for jbox2d), but they shake uncontrollable while they're moving.

It's not that there unstable, it just looks really bad because they're shaking back and forth a pixel until they settle. I've tried everything, changing gravity, density, restitution, pixels per meter, time step—nothing works.

I really need to figure out what's wrong because I don't have a lot of time to finish this.


Solution

  • I figured it out!! So glad.

    The solution is to use FBox, not FPoly. The reason was probably because Each polygon was described in huge global coordinates for the vertices, leaving the position at the default. I probably should have used local coordinates and setPosition to set the position, but FBox is even better.