Created By: Game Audio Resource Ltd Date: 09/11/2019 Version: 1.00
Wwise UE4: Chapter 05 B – Weapon:
Projectile Impact & Bounce
In this step we set up Wwise with a Blend Container so that we can trigger fast and slow impacts as the projectile bounces.
We also set basic blueprint parameters to stop over triggering of the projectile as it comes to a stop.
- STEP 01: Wwise Hierarchy
- STEP 02: Unreal Hierarchy
- STEP 03: Unreal Blueprint
- STEP 04: Test
Download the free associated written guide:
First, we set up Wwise with the associated projectile impact / Bounce content via a Blend Container using a Game Parameter for projectile speed, allowing the game to inform Wwise whether to play Fast or Slow impact audio assets.
- Navigate to the Game Syncs tab, under Game Parameter, right click the Default Work Unit, then select: New Child > Game Parameter.
Name it: GP_Projectile_Speed.
Select the Game Parameter. Change the Range values to the following:
Min = 0
Max = 3000
Default = 3000
– TIP: This Game parameter will be added to the Blueprint and send the projectile speed value to Wwise, so we can switch audio assets based on the projects speed.
- Navigate back to the Audio tab, WEP_Shotgun Actor Mixer. Right click, then select: New Child > Blend Container.
Name it: WEP_SHG_Projectile_Impact
- Open the Blend Container, then click on the New Blend Track UI Button.
Name the Blend Track: Shotgun Projectile Speed.
Close the Blend Track Editor.
- Right Click the Blend Container, then select: New Child > Random Container
- Copy & paste the Random Container, so that you have 2 Random Containers.
Name each one individually:
- With the Blend Container selected, in the Contents Editor > Assign the Slow, then Fast Random Containers to the Blend Tracks list.
- Open the Blend Track Editor again
Tick the Crossfade box, then click the >> UI Button, then assign the GP_Projectile_Speed Game Parameter.
- Then set the following co-ordinates in the graph for the slow and fast impacts.
Slow 0 > 2000
Fast 1000 > 3000
– TIP: What these do is tell Wwise what the projectile speed is, then play 1 of either 2 sets of audio assets based on the projectile speed. These speed values are default UE4 project values, which we will expose in the Blueprint later in this guide.
- Click on the >> UI Button in the Blends list. Select: Voice Volume.
On the same line click on the second >> UI Button, then assign the GP_Projectile_Speed Game Parameter.
Select the Voice Volume line, displaying a red line on the blend track.
Add a Point marker at 1500
Then drag the marker to 0.0 voice volume
Close the Blend Track Editor window.
– TIP: What this RTPC does is using the game Parameter: GP_Projectile_Speed, slowly reduce the volume of the Blend Container assign content from 1500 or below. 0 = silence.
- Drag in associated one-shot light and heavy projectile impact audio assets.
Place the assets under the File Importer Destination Path: SFX > Weapon > Shotgun
- Navigate to the ShareSets tab, under Attenuations > Weapon Work Unit, Right click then select: New Child > Attenuation
Name it: ATT_WEP_Projectile_Impact
- Open the attenuation, then set the following values:
Change the Max Distance to 2000
In the Graph, add a point marker to the red line, then move it to the coordinates X = 400, Y = 0
Right click the red line after the 400 point marker, then select the Logarithmic (Base 3) Curve
Close the attenuation window
– TIP: If you would like a larger Attenuation for the Heavy Impacts, create a another Attenuation named: ATT_WEP_Projectile_Impact_Fast. Then assign the max distance to e.g. 3000 and a marker marker at e.g. X = 500, Y = 0.0.
- Return to the Audio tab, the select the Blend Container.
In the Positioning tab add the following:
Tick Override parent.
Under Listener Relative Routing > 3D Spatialization, change the drop-down to: Position.
Under Attenuation assign the new ATT_WEP_Projectile_Impact Attenuation
- Right click the Blend Container, then select: New Event > Play
- Navigate to the Events tab
Move the Event into the Weapon > WEP_Shotgun Virtual Folder
Rename the Event to SFX_WEP_SHG_ Projectile_Impact
- Save the Wwise Project updates and Generate the sound Banks.
- Check the Weapon Sound Banks includes the new Projectile impact content.
Next, we set up Unreal data with the new Wwise associated projectile impact content.
- Navigate to the Content Browser > Content > Audio > Wwise_Event > SFX_Weapon > WEP_Shotgun folder
- Open the Wwise Picker
The drag in the SFX_WEP_SHG_Projectile_Impact Event into the Shotgun Folder.
- Double click the Event, then assign it to the SB_Weapon Sound Bank.
- Save the Event update.
- Generate the Unreal Sounds Banks.
Import the updated Sound Banks
Next, we set up the FirstPerson_Projectile Blueprint nodes with the Wwise variables we have implemented.
- In the Main Tool bar: select the Blueprint drop-down menu. Then under Open Blueprint Class
Scroll to the bottom of the list, then select the blueprint: FirstPerson_Projectile.
- In the Components tab, right click the Collision Component, then select: Add Event > Add OnComponentHit, adding the new Event to the graph.
- Right click the graph, then in the search box type: Branch, select it adding it to the graph
- Right click the graph, then in the search box type: Get Velocity, select it adding it to the graph
- Right click the graph, then in the search box type: VectorLength, select it adding it to the graph
- Right click the graph, then in the search box type: Float > Float, select it adding it to the graph
In the bottom box change the value to 250
- Connect the following nodes together
> On Component Hit > Branch
> Get Velocity > VectorLength
> VectorLength > Float > Float node (top input)
> Float > Float node > Branch node – Condition input.
- Right click the graph, then in the search box type: Set RTPCValue, select it adding it to the graph
In the Set RTPCValue Node > RTPC box, add the Wwise Game Parameter name: GP_Projectile_Speed. (This must match the Wwise Game Parameter name exactly)
- Right click the graph, then in the search box type: Post Event At Location, select it adding it to the graph
In the Post Event at Location node, AKEvent box, set the Event as: SFX_WEP_SHG_Projectile_Impact.
- Then Connect the following nodes:
> Branch node – True output > Set RTPCValue node
> Set RTPCValue node > Post Event at Location node
> Get ActorLocation node > Post Event at Location node – Location input.
> Vector Length node > Set RTPCValue – Value input.
- Mouse drag a box around the nodes we have added, then press C on your keyboard.
Name the comment box: SFX Projectile Impact & Bounce RTPC Event
- Save & Compile the Blueprint
We can now test the updates in game
- Connect Wwise to Unreal
- Solo the Projectile Impact Blend Container
- Change to the Wwise Layout: Profiler
- Filter the capture log by Projectile_Impact
- Then play the map, fire the gun at a surface allowing the projectile to bounce off multiple surfaces. You should hear the initial Main hit, then multiple bounces of the projectile as it comes to a stop.
However, before the projectile comes to a complete stop the event should stop triggering. (avoiding a lot of spam events being triggered at the end of the projectiles life)
- Make any balancing changes
- Disconnect Wwise to Unreal
- Save the Wwise project updates and generate the Sound Banks in Wwise & Unreal