Version

menu_open
AKRESULT __cdecl AK::SpatialAudio::SetEmitterObstruction ( AkGameObjectID  in_gameObjectID,
AkReal32  in_fObstruction  
)

Set the obstruction value of an emitter game object that has been registered with the SpatialAudio API. This function should be called instead of AK::SoundEngine::SetObjectObstructionAndOcclusion(), and can be used for setting the obstruction value on a Spatial Audio emitter. SetEmitterObstruction() should be used to simulate obstructing objects between the emitter and the listener, if they are in the same room, or between the emitter and a portal, if the emitter and listener are in different room. If the listener and the emitter are in different rooms, the maximum of the value passed into SetEmitterObstruction() and the the obstruction value calculated from the diffraction angle is passed to the sound engine. If the game object is not registered as an emitter with Spatial Audio, then an error will be reported, and the call will have no effect.

Note.gif
Note: The game is responsible to differentiate between obstruction between the emitter and the portal (where AK::SoundEngine::SetEmitterObstruction() should be used), and occlusion from room boundaries, which is better handled by the spatial audio diffraction system. For example, games that use ray-testing for obstruction may report 100 % obstruction when an object is very close to the the opening of a portal, because the ray between the emitter and the listener hits a nearby wall. If the game then sends 100 %, this will erroneously override the diffraction angle calculation which is probably much less than 180 degrees, and better matches the expected audibility of the sound. To prevent this scenario, games can ray-test for obstruction objects between the emitter and the portal, passing the results with AK::SoundEngine::SetEmitterObstruction(), and then test for obstructing objects between the portal and the listener, passing the results with AK::SoundEngine::SetPortalObstruction().
See also:
Parameters:
in_gameObjectID  Game object ID of the sound emitter.
in_fObstruction  Obstruction value. Valid range 0.f-1.f

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise