menu
Wwise
arrow_drop_down
Strata
arrow_drop_down
Solutions
arrow_drop_down
Apprendre
arrow_drop_down
Communauté
arrow_drop_down
Documentation
arrow_drop_down
Aide
arrow_drop_down
2024.1.4.8780
2023.1.12.8706
2022.1.18.8567
2021.1.14.8108
2019.2.15.7667
2019.1.11.7296
2018.1.11.6987
2017.2.10.6745
2017.1.9.6501
2016.2.6.6153
2015.1.9.5624
Wwise Unreal Integration Documentation
|
In the previous sections, we have covered how to play music when starting the game and from a specific time in the animation. However, some of your audio integration might require a better understanding of physics. In this next example, we'll play a sound whenever an instantiated object collides with something else.
To start, it’s recommended you create a simple system for instantiating objects in front of the character.
You can add this to your Character Blueprint. To create this 'Wwise Object' Class, create a new Blueprint Actor, add a Static Mesh component with a 1M_Cube Mesh, and enable Simulate Physics.
With this, an object will be instantiated in front of the character when you press the F key. When the instantiated object collides with any other object, we want to play a sound. For that we'll be using Unreal's OnComponentHit Event, which needs to be enabled on the instantiated object.
Open the 'Wwise Object' Blueprint Actor, select the Static Mesh and enable Collision > Simulation Generates Hit Events.
With this option enabled, we can create the OnComponentHit Unreal Event.
Right-click Static Mesh, select Add Event > Add OnComponentHit.
You can now connect this to a Post Event function and reference itself.
However, if you press play now, you would most likely get blasted with sounds when colliding, since Unreal calls even minor collisions. As such, we will filter out all insignificant collisions and only post sounds when a forceful hit is detected. This detection needs to be performed before the PostEvent is called. To measure the force of an impact, you can reference the velocity of a physics-enabled object, get the magnitude regardless of the direction in which it may hit something, and then, if this is greater than a set threshold, you can pass on the call.
From the Hit Component, get the length of the component's velocity. If it is above 40, allow the call to pass through.
You should now get a much more pleasant sound representation when the object collides with other objects. However, there is still no variation in the sound itself, whether the object is hit forcefully or just above the threshold. To achieve this, we will forward the velocity to Wwise as an RTPC. This will allow us to influence the sound with a simple volume change or with Effects. The recommended setup in Wwise is a shown:
For setting the RTPC, let's simply use the same Vector Length. However, keep in mind that you'll need to set the RTPC on the same Actor that the Wwise Event was posted on.
From the Branch, create a SetRTPCValue function and connect it to the VectorLength of the Velocity.
Refer to this video for a walkthrough of playing sounds with a threshold based on velocity.
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise