FootstepBehaviour
All your effort setting up the resolvers in your Surface
, combined with providing SurfaceModifier
, Stepper
, and StepperModifier
at runtime, results in 1 output FootstepBehaviour
that the library could play.
You can program into each FootstepBehaviour
asset how it should sounds like when requested to step each time. The component which request the step sound is called FootstepSource
, which we will explore the last.
For example, a FootstepBehaviour
representing "worn-out wooden bridge being stepped with sandals" can be scripted so that :
- It randomized from 3 different
AudioClip
, as variations. - One clip has a particularly annoying creak, so you reduce a chance that this clip would be picked.
- It should remember across consecutive play to not random into the same clip as previously randomized.
- Finally, an entire thing should play on a randomized volume of 20% to 100% regardless of picked clip, giving an impression that the bridge is unstable on only some unlucky spots, making much louder sound.
You can "program" all these and much more inside a single FootstepBehaviour
asset.
Clips
Clips is an array of "members" that are available to be chosen from for each step. No matter if you call Interval Play (repeated steps equally spaced out) or One-Shot Play (play a single step), the most granular play unit is "a step". And each of that is one of these members.
Modular Footstep picks one from all members randomly or sequentially each play, which you can setup later. Right now, let's look at available per-member settings. These settings takes effect only if it is picked.
Name
This exists only because the default Unity array drawer specifically looking at serialized field named name
and use it as foldout label. You can choose not to care and left it black to let the drawer print the default "Element 1" and so on.
Auto-name
You can automatically name all Clips to be the same as assigned AudioClip
reference by accessing context menus on the FootstepBehaviour
(right click on the header area).
The UCS option is so you can name the file according to Universal Category System (UCS) convention, which embeds a lot of metadata right in the file name. This option will extract only the part after the first _
to be used as Name.
FEETHmn-FlipFlops Walk_Hard Soil, Flip Flops, Walk_ModFst_WalkAndJumpDemo_1
Results in this name :
Hard Soil, Flip Flops, Walk
Warning
Due to programming difficulty, there is a bug where after selecting Auto-name it would appears that nothing changed. Actually data inside the asset is already updated, just that the UI didn't redraw with them yet. You need to inspect other things and come back to see the changes. (Sorry)
Clip
Attach a reference to your footstep AudioClip
here. Auto-name feature can pick up the asset name of this AudioClip
.
Volume (per clip)
Per-clip volume adjustment. This should be used to bring all members in-line with each other, not to balance the volume that is too quiet or too loud. There is one more Volume on the outer layer for that.
Use 1
to use original volume from the file. It starts as 0
, so be careful here.
In your recorded footsteps, usually there are some among your variations that are offensive in volume and is too jarring everytime that one was picked in randomization, despite your best effort to normalize to some standard like -6 dB from external application. (Because normalization only cares about the highest peak in the file.) Here you can perform last minute fixes to them.
The UI here can switch between constant adjustment and inclusive range randomization quickly, making it easy to add more organic feel to a clip.
Interval Attack Calibration
This is an advanced topic! To keep the flow of this Getting Started going nice, read about this in its own page Advanced/Interval Attack Calibration.
Volume (outer)
An overall volume adjustment that gets multiplied to the per-clip volume inside that was picked. You can again select from fixed value or inclusive range randomization to multiply.
This can be used to make this FootstepBehaviour
in line with other FootstepBehaviour
that would be used in the same area, or to apply artistic adjustments using inclusive range randomization to make the step sounds more life-like.
You will have 3 more opportunities to adjust volume in an overall manner :
- By changing output volume on the
AudioSource
attached to theFootstepSource
- Use Attenuation on the output
AudioMixerGroup
. - Using an advanced feature Advanced/Combination Volume Adjustment
So it is generally recommended to use this field to perform artistic adjustments rather than balancing.
Clip Picking Method
How the Clips section got picked each step depends on this settings. Select from either Random or Sequential, which will update the UI below with different set of settings.
Random
Pick a clip to play for each one-shot randomly from the Clips array earlier.
Random Distribution
The clips inside Clips array can be weighted so some clips are selected more often than others. The graph works like this :
- X Axis : Clips are spreaded out so that the first and last in the array is at the first and the last keyframe. Order the Clips array as desired using the grab handle. Placing the first and last keyframe at
0.0
and1.0
is optional but recommended so it is easier to imagine where each clips are on the curve. If there are 4 clips, they are spreaded out like in the image above. - Y Axis : Can be any positive number. Each clip get an evaluated value that determines relative weight to get selected. In this image, 1st and 4th clip in the Clips array have equal chance to be selected, while 2nd one is the most likely to be selected. Negative number count as 0 and the clip will never get selected.
Use this feature to make some "exceptional" step among variations rarer, such as one where you stepped over some branches hidden in the grass.
Random Exclusion Size
You used randomization to make it more natural, except if it randoms into the same one it sounds even more unnatural than sequential pick! This feature is here to fix this situation.
After any randomized pick, remember that picked member in a queue-like data structure of this specified size. (Pushed oldest one out when over this size.) All clips inside this queue are excluded from the next randomized picking.
That may sounds complicated, let's look at these examples :
- Size 0 : Random using all clips every time, allowing it to pick the same clip again and again if the chance says so.
- Size 1 : Effectively prevents the clip it just randomized to be picked again the next time when you have more than 1 clip to pick from. If there are only 2 clips total, then it would alternate picking one clip and the other.
- Size 2 : Supposed you have got 4 clips : A B C D. The first pick is A. The second pick cannot be A, and it picked C. Now both A and C are in the exclusion queue since the size is 2, the next one must be either B or D. Supposed that it picked D, now the queue is D and C since size is 2. A is now allowed to be picked again along with B which wasn't picked so far. This is one possible randomization sequence out of this settings :
ACDACBACDAC...
. (Notice that bad luck caused B to be picked only once.) - Size 3 : If you still got 4 clips : A B C D still, the prior bad luck for B situation won't occur since the size of 3 will eventually force B to be picked if A, C, D are all in the exclusion queue. Using exclusion size equal to clip count - 1 basically says random, but eventually play every clips before going to the new "round".
Size is capped at amount of clips - 1 if you entered more than that.
Sequential
Pick a clip to play for each one-shot in a specified order. Random is not always more "natural". Footsteps are in cycle, and sometimes alternating between clips would give an impression of alternating legs more than complete randomization.
The Sequence array that appears below used zero-based index.
- No sequence at all (it starts out like this) will play sequentially according to Clip array's order.
- It will go in order and repeat from the beginning indefinitely.
- Index out of range will skip that play.
Inputting it 0 1 2 1
like in the example while having 3 clips in the array will make the the play goes like this 0 1 2 1 0 1 2 1 ...
Intentionally using -1
inside the sequence to force index out of range can create irregular rhythm. Not sure why you would want this in footsteps but just in case you want to get creative...
Secondary Behaviour
This is an advanced topic! Secondary behaviour is tied to footstep "lifts" feature as well. Read about them in their dedicated page Advanced/Secondary Behaviour and Advanced/Interval Lifts.
You can now play it!
After you have programmed your FootstepBehaviour
, the only thing we have not covered yet is the FootstepSource
: Getting Started/FootstepSource
.