0 Favourites

Physic based explosion - help

This forum is currently in read-only mode.
  • Hi guys,

    I'm working on small prototype now but can't figure out one thing. I want to have physic based environment and I want to throw grenade at it... My question is, how to make an explosion in physics based game so the environment near explosion is affected in appropriate way.

    Thanks a lot.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • you could have a small Area of Effect sprite, stretch it to size dynamically and for all objects colliding it, apply a force proportionate to the distance to the center.

  • Hmm. I haven't tried this specific scenario, but I did make a kind of physics based explosion by spawning multiple instances of a physics enabled object, and adding force via events to each one.

    Possibly, you could use an explosion sprite that grows outward, and use collision events to add force, although this is just musing and I haven't tried anything remotely like it.

    Another thing with physics objects is that they don't like overlapping at all. They tend to fly out violently when stuck on top of each other.

    Always: physics object overlaps explosion sprite

    Set physics object x to explosion sprite x

    Set physics object y to explosion sprite y

    If more than one overlaps, the physics engine will fling them outwards unpredictably. I don't know if this is any use - but perhaps it will inspire more ideas.

  • Silly me, a distance threshold is much less wastefull than a collision check.

    Just pick by distance < something and then apply force accordingly

  • it doesn't like them overlapping because it's supposed to be simulating an approximation of real world physics, where things aren't supposed to overlap

    you can use the 'disable collisions with object' action on each one as it's spawned to prevent this though

  • That makes sense. If you use "get angle between point A and Point B" (and then rotate the result 180� so that it's the opposite direction) and then apply force, you should have a radial push outwards.

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