Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
English

Overview

Animations in CryENGINE can be marked up to send custom events at a specific time in the animations. This markup is used for time-aligned blending to match footplants in animations for example. Another application of the events is to spawn particle effects at the right moment.

These events can also be used for a variety of systems that need to receive information about when an animation has reached a certain point, for example in combination with a melee system etc.

Marking up Animations with Events

The events for animations are stored in an xml-based file which is loaded upon character loading. For this to be done automatically the database needs to be included in the chrparams file. See this documentation on how to create such a database and on how to create events:

Receiving Animation Events in the Game Code

The Animation Events are passed on to the GameObject once they have been triggered. The Actor and the Player implementation both handle these animation events.

See either Actor.cpp or Player.cpp for the function:

Code Block
void AnimationEvent(ICharacterInstance *pCharacter, const AnimEventInstance &event)
Chinese

总览

在动画过程中的特定时间内可标记 CryENGINE 中的动画以发送自定义事件。例如此标记可用来协调校准时间以与动画中的 footplants 匹配。事件的另一应用是在适当时刻出生粒子效果。这些事件也可应用于各种需要接收关于动画何时达到某个时点信息的系统。例如与近战武器系统相结合等。

用事件标记动画

动画事件保存在基于 xml 的可加载到角色载体之上的文件中。若要自动完成此过程,chrparams 文件中需包含该数据库。请参阅此文档中关于如何创建该数据库和事件的信息:

在游戏代码中接收动画事件

一旦动画事件被触发,将被传递到游戏对象中。人物和玩家都将实现对这些动画事件的处理。

关于该函数请参阅 Actor.cpp 或 Player.cpp:

Code Block
void AnimationEvent(ICharacterInstance *pCharacter, const AnimEventInstance &event)