Avoid overlaps without physics collision enabled ?

0 favourites
  • 8 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Hello all,

    I have a problem that beats the hell out of me.

    This is the escene:

    4 character sprites (same object type) without physics are pinned each to 4 circular sprites with physics behavior.

    I need to move those 4 pinned characters but without them bumping into each other. So, i turned off physics collisions for the circular sprites. Now those character sprites don't collide with each other.

    But, i need them to not overlap to each other when i move them at low speeds or at bounces or unpredictable collisions with obstacles.

    Two overlapped characters should separete to a minimum distance if they overlap at 0 speed or a low speed. But if a character moves fast it should still be able to "pass through" any character without any rearrangement.

    It just the slow "after bounce" objects who should not stop one over the other.

    Long explanation aside, How can i separate two overlapped characters (with physics) automatically? I tryed many things but i end with nothing good.

    If someone need clarification or a capx i will post it.

    But maybe it's a simple thing with a simple explanation.

    Regards people!

  • A collision check should do the trick, here is a demo:

    Evil Sprites

    You could adjust it to your environment, so you check for object speeds when collision happens etc.

  • The problem with your example vee41 is that i need my sprites to not collide with each other only at low speed. Also they are pinned to another sprite with physics properties (behavior).

    If i use collision checks they will bounce. And i need only stationary or slowly moving intance to be affected by the "no overlap" function/event.

    Imagine a pool table, if i shoot a ball, it should "not" bounce against other balls. But, as this ball lose speed after some time, it should not overlap any other ball if it just stop to close and overlap one.

    I guess i will need to add "speed" and "iddle" as instance variable of this objects. And filter by speed and iddle states.

    But i'm failing in all my previos attemps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My best shot so far is:


    CharMask = object with physic behavior


    CharMask => Is Overlapping <CharMask>

    |_CharMask => Is Sleeping    =>> CharMask => Apply Physics Force 40 at angle random(360)

    It work fine for any instance of CharMask (previously ordered it's Z with a for each)

    I will try to do the same for CharMask with velocity < something low. Just in case "sleeping" becomes unstable.

    If someone found a better way please tell me.

  • You could check for collision at offset (right in front of sprite) and if other object is detected you can disable collisions in case the speed condition is filled.

    Or you could use the invisible collision sprite like you said yourself. It's probably your best bet. :)

  • I updated my events this way:


    CharMask => Is Overlapping <CharMask> ==> Sistem => Wait 1 sec

    |__CharMask => Is Overlapping <CharMask> ==> CharMask => Apply Physics Force 40 at angle random(360)

       Is Sleeping

    What i do was to check if the overlapping last more than 1 second. If it do Sleeping objects moves at a random angle.

    So far is good. It do what i want. But maybe there's a better way. I'm interested in whatever optimization i can implement to this.

    I will let this topic rest for a while and see if someone shows with an elegant solution.

    Thanks vee41 for your help!

  • hi i have the same problem...can u post a simple capx file ?

  • how about using distance() ?

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