How To Get Physics to Restrict Liquid?

  • Hi all -- am looking for help in figuring out how to limit the movement of objects that have physics applied. I followed this Construct tutorial to simulate water:

    construct.net/en/tutorials/create-water-games-2172

    But now I want to move the "container" holding the water. I built this test:

    dropbox.com/s/bv0mhnjfwpt8owe/goo_test.c3p

    When I rotate the containing objects, the water objects shift outside the container. I spent hours trying to figure out some combination of physics settings to keep the water contained in the box, but nothing I've tried works.

    What can I do?

    Tagged:

  • There is no Physics in your game, it uses Bullet behavior.

    Make the borders much thicker. You can use a different invisible sprite with Solid behavior for borders.

  • Thanks for looking. I was trying some alternate methods after reading up on physics and forces (didn't realize I was working on the shared file). But whether using physics or solids and bullets, the outcome is the same: as soon as the barrier objects are moved, the ball objects flow outside the barriers.

    My hope was to eventually create a maze of sorts, so the thicker barriers are not ideal, but I'll give that a go. Given what I'm trying to do, what is the better approach: physics, or bullets and solids?

  • You can remove Bullet+Solid behaviors and replace them with Physics. The key part is to set "Bullet=yes" in Physics properties for all objects, then the water should not fall through borders.

  • Thanks for the suggestion. Physics on all objects was one of the first things I tried, but the constraining behavior seemed even worse, probably because didn't have things set correctly.

    I updated the test file with (what I believe are) your recommendations. Could I ask you to take a look again and tell me where I'm going wrong?

    dropbox.com/s/bv0mhnjfwpt8owe/goo_test.c3p

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need liquid particles and kinematic bodies - hold on a short while for my Liquidfun JavaScript (LFJS) behavior... :D

  • netdzynr Yeah, I forgot to mention - with Physics you can't use non-physics behaviors and actions to move objects. No pin, no "set angle". This is the reason why your water is escaping.

    You can only move and rotate objects with physics actions like "set velocity", "apply force" etc.

    To tell you the truth, I don't see a simple way to make a rotating closed box entirely with physics.. Maybe somehow connect all sides with distant joints.

    Colludium Your plugin looks awesome!

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