Loading an animated MD2 file (min3D framework for Android)

Posted by Dennis on May 25, 2010 in 3D, Android1 comment

I just updated min3D for Android with an MD2 file importer.  MD2 is a format that was developed by ID Software and originally used for Quake II and other games. MD2 can be used for static models but the main reason for using it is animation.

Min3D is now able to import 3 different filetypes:

This is what the code looks like. Check out the min3D sample application to see it running:


package min3d.sampleProject1;

import min3d.animation.AnimationObject3d;
import min3d.core.RendererActivity;
import min3d.parser.IParser;
import min3d.parser.Parser;

public class ExampleLoadMD2File extends RendererActivity {
	private AnimationObject3d ogre;
	@Override
	public void initScene() {
		IParser parser = Parser.createParser(Parser.Type.MD2,
				getResources(), "min3d.sampleProject1:raw/ogro");
		parser.parse();

		ogre = parser.getParsedAnimationObject();
		ogre.scale().x = ogre.scale().y = ogre.scale().z = .07f;
		ogre.rotation().z = -90;
		ogre.rotation().x = -90;
		scene.addChild(ogre);
		ogre.setFps(70);
		ogre.play();
	}

	@Override
	public void updateScene() {

	}

}

Here’s the result (click the image to see the youtube video):

Please note that it looks MUCH better on the phone.

Please note that it looks MUCH better on a handset.



Tags: , , , , , ,


1 comment

» Comments RSS Feed
  1. Awesome, looks very useful. Do you think it’s practical to use your min3d to program a 3d game as it is now?

Leave a comment