Quantcast
Viewing all articles
Browse latest Browse all 164

Footstep Audio Check Collider Hitting Floor

I have a small script that says to loop the footstep audio if the character is moving. This works great, however it references the inputs, meaning if the character is in the air the sounds still play. This script is attached to a collider trigger, and what I want is the audio to play when the collider hits a tagged object and the axis input is active, that way not only will it solve the issue but allow me to expand and add extra surfaces, grass, snow etc. The script so far is: var Walk : AudioClip; function Update () { if (Input.GetAxis("Vertical") || Input.GetAxis("Horizontal")) { if(!audio.isPlaying) audio.Play(); audio.loop = true; }else audio.loop = false; } Any ideas how I could achieve this?

Viewing all articles
Browse latest Browse all 164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>