官术网_书友最值得收藏!

Skeletons and meshes

First, we need to cover some basics on how animations are represented and used by the sandbox.

Mesh skeletons

So far, we've learned how to create mesh representations within the sandbox. We're now going to deal with an additional asset called a skeleton. Ogre, which is the underlying renderer for the sandbox, stores the skeleton and animations within a single .skeleton file. Any animated Ogre mesh within the sandbox references its animations from the media/animations folder, and in the case of our soldier, animations are located at media/animations/futuristic_soldier/futuristic_soldier.skeleton.

Loading an animated mesh

Loading an animated mesh is exactly the same as loading a normal mesh within the sandbox. Simply create an animated mesh with the Core.CreateMesh function:

Sandbox.lua:

function Sandbox_Initialize(sandbox)
    local soldier = Core.CreateMesh(
        sandbox,
        "models/futuristic_soldier/" ..
        "futuristic_soldier_dark_anim.mesh");

Showing a skeleton

By default, there is nothing visually different when loading a standard mesh or an animated mesh unless we render the skeleton. The sandbox provides an easy debug representation of the skeleton with a SetDisplaySkeleton call:

Sandbox.lua:

function Sandbox_Initialize(sandbox)
    ...
    Animation.SetDisplaySkeleton(soldier, true);

The following screenshot shows you the soldier mesh with the debug skeleton information drawn. By default, animated meshes will show up typically in a T-pose when no animations are being applied to the skeleton.

Animated mesh showing you the debug skeletal information

主站蜘蛛池模板: 千阳县| 曲阳县| 济源市| 阿城市| 晴隆县| 方城县| 炎陵县| 阿尔山市| 沭阳县| 江永县| 定远县| 新野县| 滨州市| 江阴市| 蒙山县| 客服| 澜沧| 富裕县| 龙江县| 嘉黎县| 扶沟县| 新乐市| 云梦县| 鄂伦春自治旗| 莱芜市| 甘泉县| 广安市| 沙田区| 仙桃市| 炉霍县| 雷波县| 达尔| 宣武区| 平湖市| 上栗县| 石柱| 织金县| 新化县| 弋阳县| 虎林市| 阿巴嘎旗|