CRIWARE Unity Plugin Manual
Last Updated: 2024-07-12
[CriAtom] Transceiver
Sample description
Overview
This is a sample about how to use the transceiver function to show the spatial acoustic expression.
How to use
Click the [Outside] button to move the camera (with listener) from the room to outside.
Click the [Inside] button to return the camera from the current position to the initial position (Inside).
At the same time as pressing the button and moving the camera, the direction of the sound heard by the listener changes depending on the positional relationship with the sound source and the transceiver.
The following rules decide whether the sound is heard directly from the sound source or through the transceiver:
If the sound source and listener belong to the same region, the sound will be heard directly from the sound source.
When the sound source and the listener belong to different regions, the transceiver aggregates the sounds belonging to the same region as itself and outputs the listeners in different regions.
In order to realize the operations of "playing the sound outside the room from the transceiver when the listener is inside the room" and "playing the sound inside the room from the transceiver when the listener is outside the room", use the following method to switch regions:
/* Code excerpt */
/* Attach Monobehaviour to a box shaped along the wall of the room */
/* Callback when entering the room */
privatevoid OnTriggerEnter(Collider other) {
var listener = other.GetComponent<CriAtomListener>();
if (listener != null) {
listener.region3d = regionIn;
transceiver.region3d = regionOut;
}
}
/* Callback when leaving the room */
privatevoid OnTriggerExit(Collider other) {
var listener = other.GetComponent<CriAtomListener>();