Skip to content

Scripts.FootStepKeyFrame

Wesley Haws edited this page Dec 31, 2016 · 10 revisions

##Scripts - FootStepKeyFrame

###What does this do?


This will play a sound at a specific key frame of an animation. This is used to produce footstep sounds based on the material that you're walking on. This will work with both terrain and basic objects at the same time.

###Who/What is this for?


Place this on the root of an object that needs to have it's keyframe access this script to play a sound.

###Setup


  1. Place this script on the root of your gameobject.
  2. Here are the following options
Inspector Param Type Description
Use Terrain bool Trigger on to only play sounds if on a terrain. Otherwise use both object and terrain.
No Sounds bool Do/Don't play sounds. Allows you to use an animation without breaking at each keyframe.
Material List Dict List Dictionary of material names and sound and volume options. (Number is depricated ignore it.)
Object Height Float Raycast to ground. If hit during keyframe, play the materials sound.
Position Adjustment Vector3 Start the "Object Height" Raycast from this position
Audio Source Audio Source What Audio Source the footstep sounds will be played from.
Use Override Volume bool Force the footstep sound be play at the "Override Volume" level for all sounds
Override Volume float (0 to 1) Only works if "Use Override Volume" is enabled. Sound level to play footstep sounds.
Debug Surface bool For debugging. Will log what surface the "Object Height" raycast is hitting.
Debug Height bool For Debugging. Will log the height of the raycast.
  1. Setup this how you would like. However it will error out if the raycast fails or the material was not found in the dictionary list.

Basic Setup

Basic Dictionary Setup

Clone this wiki locally