版本

menu_open
Wwise SDK 2023.1.3
集成详情——游戏对象

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

游戏对象被定义为 AkGameObjectID(无符号的 64 位字段)。您可以自由选择 ID,范围为 0 ~ 0x‭FFFFFFFFFFFFFFDF(作为有符号整数时为 -33)。 游戏对象 ID 范围 0x‭FFFFFFFFFFFFFFE0‬(-32)到 0x‭FFFFFFFFFFFFFFFF (-1) 是保留给内部使用的。transport 游戏对象,由设计工具注册,现在使用的游戏对象 ID 是 0x‭FFFFFFFFFFFFFFFE‬(-2)。

游戏对象关联

Every Event triggered in the sound engine is associated with a game object. All Event Actions are associated with 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 ignore the game object specified. If an Action affects a single game object, but the game object specified in AK::SoundEngine::PostEvent() is not valid, the Action is not executed.

Every game object can have 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 can be set on a specific item (Sound SFX, Actor-Mixer, bus, and so on) for a specific game object. 声音引擎一直存储着这些信息,直到与这些值相关的游戏对象被注销。

注册游戏对象

Before you can use game objects, you must register them. When you no longer need the game objects, unregister them. If you leave them registered, the memory used to store this information (3DPosition, RTPCs, Switches, and so on) is wasted.

AK::SoundEngine::RegisterGameObj() 函数存在两个版本:

以及

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

此函数的第二个版本用于监控目的。It displays the real name associated with objects that are playing. 在 AK_OPTIMIZED 模式下,第二个版本忽略对象名称。

You can use either of the following two functions to unregister game objects:

以及

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

备注: Reusing game object IDs can lead to unreliable associations between game objects and names in the Wwise Profiler (see Profiling) because the Profiler only displays the most recently used name when the view is refreshed.

For an example of game object integration, refer to 游戏对象示例.

参见
AKSOUNDENGINE_API AKRESULT UnregisterAllGameObj()
AkUInt64 AkGameObjectID
Game object ID
Definition: AkTypes.h:142
AKSOUNDENGINE_API AKRESULT RegisterGameObj(AkGameObjectID in_gameObjectID)
AKSOUNDENGINE_API AKRESULT UnregisterGameObj(AkGameObjectID in_gameObjectID)

此页面对您是否有帮助?

需要技术支持?

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

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

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

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

开始 Wwise 之旅