views:

177

answers:

1

How to correctly load an .md2 mesh description with Papervision 3D 2.1.932 ?

A: 

What do you mean by

mesh description

?

You can get the vertices and faces pretty easy:

var model:MD2 = new MD2();
model.load('assets/model.md2');
model.addEventListener(FileLoadEvent.LOAD_COMPLETE, modelLoaded);

function modelLoaded(event:FileLoadEvent):void{
    var md2:MD2 = MD2(event.target);
    trace('vertices: ' + md2.geometry.vertices.length);
    trace('faces: ' + md2.geometry.faces.length);
}

If you want to access other md2 specific properties like channels, which are protected, either you change your MD2 class, or you create a subclass for MD2 that exposes some of the protected variables you might be interested in as getters for example.

HTH, George

George Profenza