版本

menu_open

Integration Details - Game Objects

Introduction

Game objects are entities to which such elements as interfaces, sounds, and triggers can be attached.

A game object is defined as an AkGameObjectID (an unsigned 32-bit field). You can choose any ID that is not equal to 0x00000000, 0x00000001 or 0xFFFFFFFF (since these three are internally reserved values). So, you could either generate game objects starting from 0x00000002 and incrementing, or could use a conversion of a real pointer to real game objects.

Game Object Associations

Every event triggered in the sound engine is associated to a game object. All event actions will be associated to the game object passed as a parameter of the AK::SoundEngine::PostEvent() function, if they target a specific game object. If event actions do not target a game object, they will ignore the game object specified. If an action should affect a single game object, but the game object specified in AK::SoundEngine::PostEvent() is not valid, the action will not be executed.

For every game object, there may be an associated 3D position, a switch for every existing switch group, an RTPC value for each RTPC, and multiple values (for example a volume) that would have been set on a specific item (sound, actor-mixer, bus, and so on) for a specific game object. The Sound engine stores this information until the game object associated to these values is unregistered.

Registering Game Objects

Before you can use game objects, you need to register them. When you no longer need the game objects, you should un-register them. While leaving them registered will not create an error, memory is wasted storing this information (3DPosition, RTPC, switches, and so on).

Two versions of the AK::SoundEngine::RegisterGameObj() function exist:

and

AK::SoundEngine::RegisterGameObj( AkGameObjectID in_gameObjectID, const char * in_pszObjName );

The second version of the function is for monitoring purposes. Using it directs Wwise to display the real name associated to objects that are playing. In AK_OPTIMIZED mode, the second version ignores the object name.

Two functions allow game objects to be un-registered:

and

AK::SoundEngine::UnregisterAllGameObj() performs a complete clean-up of all the parameters currently set for every game object and removes all game object associations. UnregisterGameObj() does the same thing but for one single game object. Once a game object is un-registered, you must re-register it before you can use it again.

For an example of integrating game objects, refer to Game Object Example.

See also:

此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅