Unity | Dynamic Footsteps Showcase | Grass,Metal,Concrete

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 7

  • @ocks_dev
    @ocks_dev Год назад +5

    Nice! If I were to make this myself I would probably store a list of step sounds, a list of materials, and a list of ints. Then when the player wants to make a stepping noise I would get the material from the ground below using a raycast, look up the index of that material in the list, use that index to find the corresponding number in the int list, then use that int list number as an index to a sound effects list. Defaulting to the first index if no match is found. This way I wouldn't have to manually tag/mark every object in the game, and adding new sound effects/changing existing ones/changing which materials plays which sound would be really easy as it would just be editing the 3 lists.

  • @cateyestudios6592
    @cateyestudios6592 Год назад +2

    nice! I personally like to basically use 3d volumetrics to tell the player which zone hes in

    • @1x5x7
      @1x5x7 Год назад +2

      I am tagging the grounds and have a headbob mechanic. When the headbob reaches the lowest position (aka taking a step), an Action is triggered. I have a method subscribed to that Action and on trigger, it shoots a RayCast for 1 frame below the player's position. If the tag matches, it plays the corresponding footstep.

    • @stathiszoulakis9599
      @stathiszoulakis9599 Год назад +1

      you are smart .. im new to coding and i use blueprints from unreal engine. how whould you suggest me to learn coding ? should i try to make a game and watch tutorials when i need them or should i follow a course to make a game or somthing else@@1x5x7

    • @kikaru221
      @kikaru221 Год назад +2

      @@1x5x7 I have a similer system, but I check the name of the Raycast material and play the coresponding sound. Also, how do you "understand" when the headbob reaches the lowest position?

    • @ocks_dev
      @ocks_dev Год назад +4

      @@kikaru221 If I had to guess it either uses an animation or is generated using code. With animation you could just keyframe it to run a function when it reaches the low point, and with the code moving it up and down you would need to check the local position I assume. Although both are just things I thought of in the moment

    • @1x5x7
      @1x5x7 Год назад +3

      @@ocks_dev You are on the right track. The headbob works with a sine function defined in the code. It gives out a value to increase/decrease the localPosition of the camera (y-axis). The moment we are *near* a trough (about -5% to 0% added to the lowest trough value), we invoke the Action. I use a boolean to control the state to prevent multiple invokes at once; if the headbob reaches a vertical value of zero or higher, it resets the state.
      It's sloppy and might need some refactoring in the future, but it was fun to come up with that solution.