Search Unity

How to get plants move when the player touches them?

Discussion in 'Physics' started by the_Bad_Brad, Sep 24, 2017.

  1. the_Bad_Brad

    the_Bad_Brad

    Joined:
    Nov 2, 2014
    Posts:
    278
    Here is what I want to achieve in my game:



    I need to have the feature so that other players can detect if another player is sneaking up in the wilderness.

    So where should I start?
     
  2. Plystire

    Plystire

    Joined:
    Oct 30, 2016
    Posts:
    142
    For things like grass: This could be part of a vertex shader that accepts "nearby player position" and forces the unrooted vertices (top of the plant, specified with a "motion gradient map") over an arc directed away from the passed in position. This kind of shader is also great for doing ambient wind.

    For the large bushes you see in the video, same concept but you could use code to rotate the bushes around a pivot at their base. Have their rotation smoothed to the target rotation.