Skip to content

v0.9 Tutorial 15 MD2 Animation

contriteobserver edited this page Jul 16, 2017 · 1 revision

MD2 animations were originally used in Quake 2 and contain keyframe per-vertex animations. 3D programs like Blender are able to export to this format.

MD2 files can be imported as follows:

MD2Parser parser = new MD2Parser(mContext.getResources(), mTextureManager, R.raw.ogro);
parser.parse();

VertexAnimationObject3D myMD2Object = (VertexAnimationObject3D)parser.getParsedAnimationObject();
myMD2Object.setLight(mLight);
addChild(myMD2Object);

Playback can be triggered by using any of the following functions:

// -- play all frames
myMD2Object.play();
// -- play a specific animation, don't loop:
myMD2Object.play("crawl", false);
// -- play a specific animation, loop:
myMD2Object.play("crawl", true);

Check out the full example on Github:

RajawaliMD2Activity

RajawaliMD2Renderer

Clone this wiki locally