Thanks a lot for a quick and good response! The camera fly-through solution is great.
Also thanks for the MD2's!
I'd actually found a package containing some md2's, but the more the merrier.
I've been trying to load an animation from an MD2 object, but alas, no luck. I followed the instructions I found in a topic named "Loading animation from a md2 file" here on the board. But it seems that no matter what I do I always end up with a nullpointer exception.
How do I know the index and sequence numbers?
I can view the animations through a 3D editor, but I can't find any sort of numbering. Here's the code I use to load:
Object3D demon=Loader.loadMD2("md2/demon.md2", 0.3f);
TextureManager.getInstance().addTexture("myTexture", new Texture("md2/ql6.jpg"));
demon.setTexture("myTexture");
demon.setCenter(SimpleVector.ORIGIN);
demon.translate(800, -120, -480);
demon.build();
theWorld.addObject(demon);
And here's the code for the mainWhileLoop:
float anim = 0f;
demon.animate(anim, 1);
if (anim>1) {
anim=0;
} else {
anim+=0.1f;
}
Here's the error:
Exception in thread "main" java.lang.NullPointerException
at JPCTDemo.gameLoop(JPCTDemo.java:838)
at JPCTDemo.<init>(JPCTDemo.java:510)
at JPCTDemo.main(JPCTDemo.java:184)
For reference, here's the loading part of the MD2 file:
Loading file md2/demon.md2
File md2/demon.md2 loaded...32540 bytes
Magic number: 844121161
Version: 8
Skin width: 256
Skin height: 256
Frame size: 1120
Number of skins: 1
Number of Vertices: 270
Number of Texture coordinates: 210
Number of triangles: 488
Number of GL-commands: 2508
Number of Frames: 14
Reading Texture coordinates...
Done!
Reading polygonal data...
Done!
Reading keyframes...
Done!
Coverting MD2-format into jPCT-format...
Processing: pigstand...
Processing: pigwalk...
Processing: pigpain...
Processing: pigbite...
Done!
Am I supposed to be able to identify sequence/index numbers from this?
It seems to identify the animations like "stand", "walk", etc.. For a later feature, it would be great to be simply able to call Object.Animate("Walk"); or something of the sort.
But to sum up: Can't play animations of MD2 files, nullpointer error prevents it. Completely clueless of how to figure out index and sequence numbers.
Sincerely,
-Raven