- Home /
Changing Footstep Sounds On Different Surfaces
Hey guys. So I just made up this simple script that is going to tell when the player is walking on different floors to be able to change the footstep noise. However, I'm not entirely sure how to change the variables. So attached to my player is the standard First Person Head Bob script that came with the standard assets. I'm trying to get it so that this script will tell what surface the player is on by using a tag or something, and then changing the variables of the First Person Head Bob script to some preset audio clips.
This is the script I have so far:
var player : GameObject;
var woodSound : AudioClip;
var metalSound : AudioClip;
var script : FirstPersonHeadBob;
function Start() {
script = player.GetComponent<FirstPersonHeadBob>();
}
function OnTriggerEnter(other : Collider) {
if(other.gameObject.tag=="Wood")
{
script.FootStepSounds = woodSound;
}
}
I'm not sure if I'm doing it right. Any help or advice on this?
Your answer
![](https://koobas.hobune.stream/wayback/20220612082117im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sprinting Problem 0 Answers
How can i make my audio loop faster/slower? 0 Answers
GetComponent().Play(); Question(s) 2 Answers
footstep audio sync probs 0 Answers
My Footstep isn't working 2 Answers