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

Wind Area that pushes player in certain direction

Discussion in 'Scripting' started by smashingdashing, Jun 23, 2019.

  1. smashingdashing

    smashingdashing

    Joined:
    Apr 18, 2016
    Posts:
    33
    Hey everyone, I was just wondering how I could go about adding wind in a certain area that pushes the player in a certain direction - in which the player has to fight to get past. This is in a 3rd person world as well, are there any guides on how to do this?


    Thanks :)
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,971
    Some random ideas:

    If you're using physics to move your player, you might be able to get the right effect with a force that you apply whenever the player is in a certain area.

    For "being in a certain area," the easiest is to check distance to a single point, or else to use an axis-aligned bounding box, which is quick and easy to check your position against.

    Alternately you can use physics and triggers (remember to add a rigidbody) and decide from there which wind area you're in.

    If you're not using physics then you would need to add in a wind offset after you have gathered the user's input. That way if you are not putting any input in, the only thing moving the player would be the wind.

    Hope that gets you started and trying some interesting things.
     
  3. smashingdashing

    smashingdashing

    Joined:
    Apr 18, 2016
    Posts:
    33
    that does help thank you, but with my little coding knowledge I am undable to do much unfortunately lol I was hoping there was a guide on how to do so, or something similar but I've searched YouTube, Google, and the forums here and haven't managed to find it, unless I'm not using the correct terminology when I'm searching
     
  4. Tpleme

    Tpleme

    Joined:
    May 10, 2019
    Posts:
    7
    hey, got some videos here.



    Not sure if that the thing you want but you can search for "Wind force on Unity" and you find a lot to see :D