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

Fire Following Player's

Discussion in 'Scripting' started by Feringa, Jan 8, 2013.

  1. Feringa

    Feringa

    Joined:
    Jan 8, 2013
    Posts:
    3
    Hi all!

    I am not really having an issue but i would like to see another point of view.
    me and my group are making a game where a building is burning and you have to find you're way out.
    But to prevent the player from going back (when he take's the right path ofc) there is fire following him/her.
    Now i am currious how would u guys let the fire follow the player from a distance.
    Letting the fire follow te player is easy but i dont want it so static that the fire is always 10 feet away from u but always a little bit different.

    Any idea's ?
    reply to this post or mail me!
    Woutferinga@live.nl
     
  2. Dark-Protocol

    Dark-Protocol

    Joined:
    Nov 19, 2011
    Posts:
    279
    Well you can always lerp the position of the fire. That way it won't be so static to the player.
    Vector3.Lerp


    Another way is to set up a timer and check if the player is away from the fire and the timer has run out. That way you can start running from the fire and after whatever time you give the timer, the fire will start following.

    Another way is with only distance checking. When the fire is close to the player it checks if the player is withing distance "A", if not, then start following the player and check if the fire is within distance "B" (which is shorter than A) - that way the fire will get close to you and if it's not chasing you, you have some space to move around within which the fire won't start chasing you.

    Those are several ideas that came to mind. You can even try and combine them.
     
  3. Feringa

    Feringa

    Joined:
    Jan 8, 2013
    Posts:
    3
    the second idea is about the same idea i just had think i am going to try that :) thanks for the reaply!