0 Favourites

Physics objects can't quite touch each other?

  • I just started working on a new physics based project, and I noticed that the physics objects, when pressed against each other, don't quite touch, as if there's an invisible 1 pixel wide force-field separating them. It doesn't appear to be a rendering issue, as when I set the layout zoom to 4x, the gap increases proportionally, becoming about 4 screen pixels wide.

    In older projects physics collisions appeared perfectly accurate up to 10x zoom, much less 1x.

    I don't recall ever seeing this happen in any prior projects.

    I now can't get precise collisions to work in any new projects.

    Is there something that changed in the physics behavior, or is there a setting that might help?

    Any thoughts or suggestions welcome.

  • maybe your collision polygon is slightly off...

    or maybe try the old Box2d web physics engine instead of the newer asm.js (or give Chipmunk Physics a try)

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thanks for the reply AllanR,

    I double checked the polygons but they were just bounding squares around objects that are squares. The individual vertices are all at integer coords, so I don't think the polygons are off. Likewise if I actually just set all the objects to bounding box collision mode (rather than polygons) I get the same gap.

    Setting the collision mode to circles seems to produce the nearly perfect collisions I recall from older projects, but unfortunately, my objects are not all circles, so that's not really a long-term solution.

    The "web" version of Box2d does seem to be quite a bit better with a gap about 1/4th or less than the size of the "asm.js" version.

    It almost seems like the collision poly lines themselves have some kind of line-thickness.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)