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
|
So far, we have built everything directly in our level, using prebuilt actors or adding components to individual actor instances. It's also possible to use the various spatial audio components to construct a Blueprint actor that can be replicated throughout the level. In this section we will build a replica of the structure from section Unreal Project Preparation, using a Blueprint class so that it can be easily added or spawned throughout the world.
info |
Note: The Preparation for the Spatial Audio Tutorials must be completed prior to starting this tutorial. |
AkLateReverbComponent
and AkRoomComponent
rely on containment tests to check whether a given game object position lies within their parent PrimitiveComponent
. Simple collision is used for this check. You should therefore use a parent PrimitiveComponent
that has simple collision. For example, you could use a box collision, sphere collision, or capsule collision component. If the PrimitiveComponent
has no simple collision, the containment test will simply use the component bounds, which may be less accurate.
It is also possible to add simple collision to a mesh asset in Unreal (refer to Setting Up Collision With Static Meshes). However, for complex meshes, such as those with doorways and openings, it is sometimes necessary to 'use complex collision as simple' in the collision settings for the mesh (refer to Simple Vs Complex Collision). For example, this setting might be required to allow a character to enter a room through a doorway but still collide with the walls. When this setting is used, the containment tests for AkLateReverbComponent
and AkRoomComponent
will fail, as the simple collision will be ignored, and the mesh's full trimesh will be used. The simple collision tests used by AkLateReverbComponent
and AkRoomComponent
do not support trimeshes. For that reason, the recommended setup in a Blueprint class is to have a simple collision component as the parent when using AkLateReverbComponent
component and AkRoomComponent
. For example, the simple collision component could be a box, sphere, or capsule. If you have a specific mesh for a room or building, the simple collision component(s) could be added to the mesh as a child component(s).
Click on the new static mesh component and select the mesh in the Details panel.
info |
Note: Automatic assignment of rooms to portals only works for convex meshes. Concave meshes (e.g. L-shaped rooms) do not produce accurate portal room intersection. |
Add a box collision component for each of the individual rooms and doorways in the mesh.
At this point, all of the box collision components are positioned in the same place; on top of each other. We'll reposition, scale, and rotate them so that they align with the rooms and doorways. The easiest way to do this is to use the Orthographic view. (The following steps are specific to the SpatialAudioDemoMesh, but similar steps can be performed for other meshes.)
info |
Note: When aligning rooms and portals to the mesh in this tutorial, don't worry if they're not perfectly aligned or centered. Just be sure to roughly cover the correct areas. When designing a real environment, you can use the Transform section of the Details panel to input exact values. |
In the Viewport tab, click Perspective and change the view to Top.
Scale BoxRoomLarge along the x and y axes until its size matches the dimensions of the large room. (You can switch to scale by pressing R or selecting the Scale widget in the Viewport tab).
Select BoxRoomSmall and scale it along the x and y axes until its size matches the dimensions of the small room.
Select BoxPortalInner and zoom in on the wireframe until you see the extents of the inner doorway on the mesh.
Move BoxPortalInner to the middle of the doorway and then scale it along the x-axis such that it covers the extent of the doorway.
Select BoxPortalOuter and rotate it so that its local y dimension is pointing out of the doorway.
info |
Note: This is necessary because portals have front rooms and back rooms which are automatically assigned by detecting the closest intersecting room along the portal's y dimension. In the case of the BoxPortalOuter, the 'back' (in local coordinate space) will be connected to the small room in our mesh, and the 'front' will not be connected to any room. |
Rotate BoxPortalOuter around the z-axis by 90 degrees. This can be achieved by typing '90' into the z-axis Rotation text box in the Transform section of the Details panel.
In the top view, ensure all rooms and portals are aligned with the mesh, as shown:
Select BoxRoomLarge and BoxRoomSmall and scale both along the z-axis so that they match the dimensions of the room.
Select BoxPortalOuter and BoxPortalInner and move them down to the center of the doorways, then scale them along the z-axis so they match the dimensions of the doors.
We will now add AkRoom components to the rooms, and AkPortal components to the portals.
For each box collision component, create a room or portal component (as appropriate) with a name similar to the parent. The result should be as shown:
info |
Note: AkRoomComponent and AkPortalComponent are generic components that can be added to any primitive component. See AkRoomComponent and AkPortalComponent for more information. |
To confirm that the portals have valid placement, select the Visualize Rooms and Portals option in the Integration Settings.
Lines are now drawn between connected rooms and portals. If portals have invalid placement, they will be visualized in red.
info |
Note: A portal has invalid placement if it is not connected to any room, or if the same room is connected to both sides. See AkPortalComponent for further information. |
The last two items to add to the Blueprint class are AkGeometry and AkLateReverb components.
Add an AkLateReverb component to the BoxRoomLarge box collision component.
The Blueprint class is now ready to use. We can drag an instance of the class into the world.
Position it beside the existing building.
Confirm that rays pass through the portals correctly in the new Blueprint structure.
To test the late reverb component, you must add a sound and position it within the large room in our SpatialAudioBP instance. Right-click on the existing Play_Outside AkAmbientSound actor in the world and duplicate it.
Move Play_LargeRoom_BP inside the large room of our SpatilAudioBP instance.
Open the Level Blueprint and add logic to play the Play_LargeRoom_BP sound when the B key is pressed (see Unreal Project Preparation step 3).
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