Footsteps
Overview
Footsteps in NeoFPS are handled using a combination of MonoBehaviours and motion graph behaviours. This allows a great deal of flexibility and control over when and how footsteps are triggered. For more information on the specific behaviours, follow the links below.
Footstep Implementation
Basic Footsteps
The motion graph SurfaceFootstepAudioSystem is component added to the character that is used for basic footsteps on various surfaces. It is controlled via the SurfaceFootstepAudioBehaviour motion graph behaviour. This has properties for adjusting the frequency of the steps, the surface audio library to use, and parameters such as the cast direction and distance for surface checks. For each step taken it will choose an audio clip at random from the surface audio library to play. The behaviour can be attached to multiple motion graph states with different properties, so the system can be used to trigger different audio clips based on the character's motion state such as running, sneaking, walking, etc. The component on the character also fires a C# event on steps that can be used to tie it in to other systems.
Sliding
The motion graph SlidingAudioBehaviour is used to play looping audio when the character is sliding on various surfaces. Properties are available to change the surface audio library, and to pitch shift the audio based on the speed of the character.
Lift-offs
The motion graph SurfaceAudioBehaviour can be used to trigger surface based audio clips in various situations, including jump lift-offs. It can be combined with the motion graph PlayCharacterAudioBehaviour to trigger character grunts and exertion noises when jumping.
Ladders
The motion graph LadderAudioBehaviour is used to play audio clips as the character ascends and descends a ladder. It has properties to control the frequency of the audio clips based on the climb speed, as well selecting the relevant surface audio library.
Landings
Landings are handled slightly differently, as they need to react to the force of the impact in order to add flavour such as bone crunches or grunts for very heavy landings. When the character lands, the motion controller fires impact events that can be handled by any behaviour. The demo character implements this feature and has properties for soft and hard landings.
See Also
Motion Graph FootstepAudioBehaviour
Motion Graph SlidingAudioBehaviour
Motion Graph SurfaceAudioBehaviour
Motion Graph PlayCharacterAudioBehaviour