Enable/Disable Physics collisions issue r80.2

0 favourites
  • 5 posts
From the Asset Store
Perfect Particles
$2 USD
80% off
Particles support animations, collisions, effects and etc.
  • I've come across this issue and was wondering if it could be a bug, I've prepared a small demo, check the .capx.

    Basically, if 2 objects are already making contact, disabling collisions won't affect them.

    Anyway, here's the capx: http://dl.dropbox.com/u/1910765/bugtest.capx

    As you can see, if you disable collisions when the 2 objects are already making contact, the first object will stay there instead of falling down.

    Hope it helps. Thank you.

  • I'm not sure we can fix this - it's handled by the physics engine entirely, and it only filters collisions at the start of a touch, not during. Maybe you can work around it by applying a little impulse to the object after disabling the collision? That might make it "wake up".

  • I see. I tried applying an impulse but it really needs to make a big bounce before it bypasses this, and it's too much noticeable anyway. I even tried moving the top sprite position up or down, but still it won't "let go".

    The only way I can think of would be to cheat, replacing the bottom sprite with a clone without physics at the exact moment you want the top object to drop. I guess I'll do that.

  • The only way I can think of would be to cheat, replacing the bottom sprite with a clone without physics at the exact moment you want the top object to drop. I guess I'll do that.

    Ok, actually that worked really well. If anyone is interested in an example I'll update the capx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This bug is a result of cached contacts, and is not really a bug. Box2d does offer a way to get around this caching though. The only way to get around it in more recent versions of box2d (2.1a or later), is to filter it out during presolve. In presolve you can disable the contacts that need to be disabled at run time. Once the objects' AABB are no longer overlapping - which is not the same as isTouching in box2d, the contact will function as expected.

    PreSolve and PostSolve are missing from AMS.JS in the the bindings. Consequently this can only be fixed in box2dweb.

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