Search Unity

Create Raindrop Falling into Water Effect

Discussion in 'Scripting' started by kylebrosse, Jun 18, 2018.

  1. kylebrosse

    kylebrosse

    Joined:
    May 17, 2018
    Posts:
    1
    Hello, I am trying to create an effect like the one in this website http://www.iamveryverysorry.com/ but in a 3d environement. So I want to create the random falling raindrop that hits a plane at 0 and creates the ripple effect. I am just getting started with Unity so anything at all helps! Thank you!
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    There are many ways to achieve that kind of effect, but I think the following approach would be simplest. It's still somewhat complex, so you probably need to play around with some tutorials to get a hang of some of these concepts.

    Start with an image of a circle. It should have a transparent background, and the stroke should be white. Add that image to your Unity project. You can also find a water droplet image like the one in the link you shared and bring that into Unity as well.

    Create a scene with a camera looking slightly downward at the ground. Maybe 30 degrees down from horizontal.

    Next, we have two things happening: 1) The water droplet is falling down and hitting the ground. 2) When it hits the ground, it creates the ripple effect at the point of impact. To implement the first approach, you'd create a game object that contains a world space canvas. The canvas would contain the droplet image. Add a collider to the game object and a rigidbody to the game object. Now add a script to the game object that that handles OnCollisionEnter. When that method is called, you'd destroy the game object, and create the ripple object at the `collision.contacts[0].point` position.

    The ripple game object would also contain a world space canvas, and an image of the circle, facing upwards. Add a script to this object whose Start sets its `transform.localScale` to `Vector3.zero`, and where the Update() method increases localScale by a small amount each frame. That will give you the growing effect. It looks like you'll always want to gradually decrease alpha of the image's color, which will cause it to fade away. After a certain length of time, destroy the object.

    Once you've done all that, you'd store these two game objects as prefabs, and then instantiate them as necessary. Instantiate the droplet prefab and give it a random position in the air. And instantiate the ripple prefab in the OnCollisionEnter method of the droplet prefab's script.

    Anyway, as I've written this all up, it's definitely more of an intermediate thing than a beginner thing. But good luck.
     
  3. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    particle system for the raindrops and a shader for the rain ripple effect on surfaces
     
  4. Ian094

    Ian094

    Joined:
    Jun 20, 2013
    Posts:
    1,548
    The Particle Pack includes a rain effect with ripples.

    Check it out, it may be what you're looking for.