Search Unity

Question i neeed help making audio which activates whenever the player steps

Discussion in 'Audio & Video' started by imakegam313, Feb 18, 2024.

  1. imakegam313

    imakegam313

    Joined:
    Aug 12, 2023
    Posts:
    1
    for my game i have an active ragdol so tying the audio to animation doesnt work i have a player model made up of different body parts and at the moment i check for a collision with the feet for the ground and then i play the sound but since im using on collision enter whenever the foot slightly scrapes off the floor and back on it plays the sound is there any way to prevent this i can provide any info on how my character is set up if needed.
     

    Attached Files:

  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    407
    A few ideas:
    • If you had a velocity value for your foot, you could set a threshold value to play the sound or not
    • You could have a smaller collider within the foot to trigger the audio, so it would happen only when you have a fuller contact
    • If quick re-firing of the sound is the problem, you could add a debouncing time value, forcing a minimal interval between each footstep sound.