Chapter 7. Animation

There are two approaches to playing a 3D animation in our engine. They both use TCastleScene for playback, start the animation by calling TCastleScene.PlayAnimation or setting TCastleScene.AutoAnimation.

7.1. Interactive (glTF, X3D, VRML, Spine...)

This approach means that you load one model file, and the TCastleScene (actually, ancestor TCastleSceneCore) will make the events work, sending/receiving events through routes, activating sensors, running scripts etc. Among many things, this means that world time will be passed to TimeSensor nodes, allowing you to animate by interpolator nodes. You can also pass user input to TCastleSceneCore methods like TCastleSceneCore.KeyDown, and then the user will be able to fully interact with the VRML scene.

This is what should be used for presenting interactive X3D / VRML world to the user, as envisioned by X3D / VRML specifications.

7.1.1. 3D formats support

This plays animations from:

  • glTF,

  • X3D,

  • VRML,

  • Spine JSON,

  • sprite sheets (from .castle-sprite-sheet, Starling, Cocos2d formats)