Skip to content

SkeletonAsset Guide

Mike Lilligreen edited this page Mar 29, 2014 · 3 revisions

Introduction

All assets are known engine types that allow instances to be created at runtime. The "SkeletonAsset", like all assets, is derived from a base type of "AssetBase". That means it includes all the fields from that type as well as adding its own fields specific to itself.

The SkeletonAsset directs the engine to specific files that are exported from skeletal animation programs. Currently the only program supported is Spine. For a SkeletonAsset to be valid, it must reference two exported files from Spine.

A SkeletonAsset is used in the engine through a "SkeletonObject".

TorqueScript Bindings

Exposed Fields

The SkeletonAsset type exposes the following fields in addition to those it inherits. Shown are the equivalent methods available that perform the same action in setting and getting the respective field:

  • AtlasFile
  • setAtlasFile(string)
  • getAtlasFile()
  • SkeletonFile
  • setSkeletonFile(string)
  • getSkeletonFile()

The following is a complete description of each of these fields.

AtlasFile (string)

The file path for the location of the Spine Atlas file. If your asset file is located in the same folder and the atlas file, then only the name of the file is needed.

%spineAsset.setAtlasFile("goblins.atlas");

SkeletonFile (string)

The file path for the location of the Spine Skeleton file. If your asset file is located in the same folder and the skeleton file, then only the name of the file is needed.

%spineAsset.setSkeletonFile("goblins.json");

TAML Format

Using TorqueScript and the exposed fields or methods described in the previous sections, you can programmatically create and configure a SkeletonAsset. You can then export this type to a TAML file or even create a TAML file manually and read it into your game at an appropriate time.

If we take the script from the previous section, here is the example SkeletonAsset TAML file in XML format:

<SkeletonAsset
    AssetName="goblins"
    AtlasFile="goblins.atlas"
    SkeletonFile="goblins.json"/>