Hello Revalis,
Sorry i forgot to tell you to edit another line. Find this code in
your MD2.as :
for (i = 0; i < num_tris; i++)
{
var a:int = md2.readUnsignedShort();
var b:int = md2.readUnsignedShort();
var c:int = md2.readUnsignedShort();
var ta:int = md2.readUnsignedShort();
var tb:int = md2.readUnsignedShort();
var tc:int = md2.readUnsignedShort();
mesh.indexes.push([a,b,c,ta,tb,tc]);
mesh.addFace(new Face(_vertices[a], _vertices[b],
_vertices[c], null, _uvs[ta], _uvs[tb], _uvs[tc]));
}
And change
mesh.addFace(new Face(_vertices[a], _vertices[b], _vertices[c],
null, _uvs[ta], _uvs[tb], _uvs[tc]));
to
mesh.addFace(new Face(_vertices[c], _vertices[b], _vertices[a],
null, _uvs[tc], _uvs[tb], _uvs[ta]));
Hope that will fix your inverted normals. :D
On Nov 1, 9:45 pm, Revalis <[email protected]> wrote:
> Guess it's more precise to say it -also- inverted the normals... it
> appears to have mirrored it the right orientation.. I can just see
> through all the front faces now. Getting closer! :P
>
> On Nov 1, 3:38 pm, Revalis <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hrm.. adding the "-" to position.z inverted the normals on my
> > polys. :P I meant to say the model itself is mirrored, as in the
> > things modeled onto the left side of the object in Max actually appear
> > on the right side in Flash. And also any text part of the material is
> > backwards/mirrored (which is what made it obvious).
>
> > In regards to the speed, though, thanks for pointing out the .fps
> > property. Totally overlooked that.. but saw in the Md2.as that it
> > appears to default to 10. So setting it higher kicked my animation
> > speed on up to what I was looking for.
>
> > Thanks!
>
> > On Nov 1, 3:12 pm, Aji Pamungkas <[email protected]> wrote:
>
> > > Ups... sorry for the * character in the code.
>
> > > On Nov 1, 9:09 pm, Aji Pamungkas <[email protected]> wrote:
>
> > > > I had the same mirrored-MD2 problem when importing MD2 that was
> > > > exported by
> > > > using MD2 Exporter in Blender. What I did to fix it was by editing
> > > > MD2.as
> > > > file. Open your Md2.as file, you will find this code :
>
> > > > * for (var h:int = 0; h < _vertices.length; h++)*
> > > > * {*
> > > > * var position:Number3D = new Number3D();*
> > > > * position.x = -((sx * md2.readUnsignedByte()) + tx)
> > > > *
> > > > scaling;*
> > > > * position.z = ((sy * md2.readUnsignedByte()) + ty) *
> > > > scaling;*
> > > > * position.y = ((sz * md2.readUnsignedByte()) + tz) *
> > > > scaling;*
> > > > * md2.readUnsignedByte(); // "vertex normal index"*
> > > > * frame.push(position);*
> > > > * }*
>
> > > > And change "*position.z = ((sy * md2.readUnsignedByte()) + ty) *
> > > > scaling;*"
> > > > to "*position.z = -((sy * md2.readUnsignedByte()) + ty) * scaling;*".
> > > > You'll
> > > > notice that you only need to add "*-*". :D
>
> > > > About your performance issue of MD2, I never had any problem, maybe
> > > > because
> > > > my MD2 models are low poly, between 50 to 200 triangles, 50 frames
> > > > maximum.
> > > > This is how i play my MD2 animation :
>
> > > > var animData:AnimationData =
> > > > (maincharView.mesh.animationLibrary.getAnimation(animName) as
> > > > AnimationData);
> > > > animData.animator.fps = fps;
> > > > animData.animator.loop = loop;
> > > > animData.animator.gotoAndPlay(0);
>
> > > > --
> > > > Aji Pamungkas
>
> > > > On Mon, Nov 1, 2010 at 8:28 PM, Revalis <[email protected]> wrote:
> > > > > Oh. Other weird thing I forgot to mention is that when the model comes
> > > > > in, it is mirrored. And I don't recall my collada imports doing that;
> > > > > but I may have just been ignorant of it and only just now noticing. :P
>
> > > > > On Nov 1, 2:24 pm, Revalis <[email protected]> wrote:
> > > > > > Hey guys,
>
> > > > > > I am moving over to using .md2 from .dae since the new animation
> > > > > > libraries seem to be a bit friendlier; however, I am getting some
> > > > > > weird performance issues. :/ Just wanted to make sure I'm not
> > > > > > overlooking a process for optimizing my movie.
>
> > > > > > I am taking the exact same model/animation sequenceI I had
> > > > > > previously
> > > > > > exported to .dae and have used QTip to export it, with animation, to
> > > > > > md2. In regards to file size, it is much more compressed.. which I
> > > > > > like.
>
> > > > > > Codewise, the only thing different I did was call 'new Md2' instead
> > > > > > of
> > > > > > 'new Collada' (And every reference of Collada to Md2). Still using
> > > > > > the
> > > > > > LoaderCube and still importing my material with a Loader (then Cast
> > > > > > to
> > > > > > BitmapMaterial).
>
> > > > > > When I play the animations in Away/Flash, they appear to move
> > > > > > incredibly sluggishly. Almost 2-3 times as slow.
>
> > > > > > Is this to be expected? Or is the Md2 a less forgiving format to
> > > > > > polycounts than Collada? This model sits at 1823 polys and 70 frames
> > > > > > of animation.
>
> > > > > > The walk cycle is frames 2 - 27 and Stats is showing me an average
> > > > > > of
> > > > > > 10-12 out of 31 FPS.
>
> > > > > > Now, if I watch the same .swf in IE, I will see an average of 19-20
> > > > > > FPS.
>
> > > > > > Regardless of that speed, though, the animation itself is, visually,
> > > > > > slower than it is animated in Max.
>
> > > > > > Hopefully this makes sense.. otherwise I might have to do some
> > > > > > recordings to prove I'm not insane! :P- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -