Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Programatically Control Water Flow

Discussion in 'Editor & General Support' started by ryno_coder, Nov 27, 2013.

  1. ryno_coder

    ryno_coder

    Joined:
    Nov 5, 2012
    Posts:
    21
    Hello All,

    I'm in the beginning stages of a scene in my Unity project and still a newb to Unity3D. I'm having a lot of trouble thinking of ways to simulate a fixed volume of water flowing into a container. In short, I want to create a container full of water and then via unplugging/plugging the hole at the bottom of the container, control the amount of water that would flow into a cup under the hole. The container should drain as the water flows out.

    Is something like this possible? If it is, anyone that can point me in the right direction would be very helpful and much appreciated.

    Thank you.
     
  2. sputnikbar

    sputnikbar

    Joined:
    Jan 3, 2013
    Posts:
    78
    Hi,

    you could consider that it's a "cylinder" of water inside your cup.
    So, scaling your cylinder according to the amount of water is easy.
    You could compute the amount of water flowing with the time ellapsed between unplugging/replugging the hole of the container.

    hope it helps,
    L.
     
  3. ryno_coder

    ryno_coder

    Joined:
    Nov 5, 2012
    Posts:
    21
    Hello,

    Thanks for your reply. I think I understand what you're saying. Give the illusion of water filling a cup by dynamically increasing the size (via increasing the scale) of the cylinder. Do the same for the container that the water is flowing out of but this time shrink the scale, to give the illusion that the container is being emptied.

    R