版本
Wwise Unreal Integration Documentation
|
A common task in game production is posting footstep sounds. This tutorial uses footsteps as a practical demonstration of how to post sounds from a specific moment in animation. You can use the same approach for other sounds and animations, such as doors opening and closing. In addition, the tutorial demonstrates how to use Unreal Surface Types in combination with Wwise Switch Containers to change the sound of footsteps when the player character moves from one type of surface to another.
This tutorial uses the ThirdPersonCharacter project template, which includes a Mannequin (playable character controller) with input controls and animations. The following sections explain how to integrate footstep sounds by adding Animation Notifications to an animation of the character running. A Blueprint receives the notifications and posts the sound.
The footstep implementation in this tutorial uses Unreal's Physics system extensively. For more information, see Physics.
Before you proceed, create or obtain some footstep sounds for at least two different types of surface (such as dirt, gravel, or grass). You must also do some preparatory work in your Wwise project.
To prepare for this tutorial:
TIP: The Wwise Integration Demo project contains a Footsteps container with sounds for multiple surfaces. |
To play footstep sounds that are synchronized with the player character's movements in the game, you must use Anim Notifies. The following procedure explains how to add Anim Notifies to character animation states in Unreal, at the precise moment when the character's foot touches the ground. You can then update the character Blueprint to post Wwise Events based on the Anim Notifies.
To add Anim Notifies for footsteps:
In the timeline, align the Playhead with the first R in the top track, which is the moment the right foot touches the ground.
Copy the Footsteps Anim Notify and paste it so that each of the other R and L notifies has a corresponding Footsteps Anim Notify.
To test footstep sounds on different surfaces, your level must contain at least two different sections of floor, to which you can assign different Physical Materials. You can then associate Switches with the different surfaces so that the footstep sounds change when the character moves from one surface to another. Use surfaces and materials that correspond to the sounds in your Wwise Switch Container.
This approach uses Unreal Static Meshes and Physical Materials. For more information, refer to Physical Materials and Static Meshes.
To add a second floor surface to the level:
Double-click one of the new Physical Materials and in the Details Panel, under Physical Properties, select the corresponding Surface Type.
In the Collision section, set the Phys Material Override to the desired Physical Material.
In the Materials section select a Material that resembles the desired Surface Type. Repeat for the second floor object. The following image shows an example of a level with a floor divided into metal and dirt sections.
After you add Footstep Notifies to the character animation and configure the different surfaces in the level, the final step is to configure the Mannequin Blueprint to determine which surface is beneath the player, route that information to the correct Set Switch function, and finally post the Event to Wwise, which then plays the appropriate footstep sound.
This procedure uses the same MF_Run_Fwd animation sequence from Adding Footstep Anim Notifies.
To set a Surface Switch:
Configure the first part of the Blueprint with a Line Trace By Channel function to detect the player character's footsteps, as shown in the following image.
Configure the second part of the Blueprint to detect whether the player is on a valid surface type and if so, to route the signal to the correct Set Switch function and then post the Wwise Play_Footsteps Event to play the correct sound.
Here is a diagram of the entire Blueprint: