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

How to play footsteps on a ground not flat ?

Discussion in 'Scripting' started by Defcon44, Aug 20, 2015.

  1. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hello,

    I use RFPS for my own game currently in progress and i need you'r help for footsteps fix.

    I have a footsteps.cs script, on this script we are all surfaces (wood, stone, sand, water etc) and TAG in the which surfaces are assigned them (Surface dirt = Dirt Tag). Then the player walk on prefab with tag "wood" the footsteps/jump sound wood play.

    The problem is with the ground, my ground is not flat, thus if I put the ground with " sand " TAG and I add smooth to plane collider for the forest so when the player will walk on a bump in bit or in a hole the sound "dirt" or "foliage" will not play.

    I have two ideas to fix that :

    1) Create a script which detects textures of the ground then I can add a tag has this texture so when the player walks on the sand texture the sound " sand " plays.

    or

    2) Create a zone which defines a surface, when players is in this zone sounds "sand" play.

    You'r are my last chance to fix this, nobody reply me on RFPS forum :/

    If you need ask I

    Thank you
     
  2. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    No body are idea ?

    Please
     
  3. lineupthesky

    lineupthesky

    Joined:
    Jan 31, 2015
    Posts:
    92
    I wouldn't prefer the texture way, it might be too costy. Well, I would make the zone triggers at the same height as the player's height, so that it will be almost independant from the buttom of the player, meaning it won't be affected too much by your landspace thoughness. But ofcourse, this may change according to your terrain, there but it seems like a good fix for now. Just put your triggers up, they will eventually detect the player, or you can make your triggers bigger.
     
  4. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks for you'r reply :)

    So, what i need to make this ? I mean, what i need to write in C# for a script ?

    thanks