Hello,
In my example, I have a <flag object> in MD2 format, placed in my animation code and works perfectly. However, since MD2 is an old single byte and obsolete format, it’s preferable to use 3DS for animation. I am learning to use 3DS for animation and follow all jPCT documentation, examples and forum topics about. Using Blender 2.72, I managed to create all the 3DS keyframes files of the <flag object> and add them to my modified animation code. Everything loads ok,
but the FLAG doesn’t MOVE.
I have been hours treating to see why. Don’t see where it is the problem.
PLEASE HELP!The following code, is to check the mesh’s, preloading and post animation:
Object3D flag = new Object3D(load3DSModel("xflag/flag_000001.3ds", 40 * h / 552));
flag.build();
Mesh M1 = flag.getMesh();
Object3D flag2 = new Object3D(load3DSModel("xflag/flag_000002.3ds", 40 * h / 552));
flag2.strip();
flag2.build();
Mesh M2 = flag2.getMesh();
System.out.println("------------ CHECK INITIAL MESH's -------------");
if (M1 == M2) {
System.out.println("M1 = M2");
} else {
System.out.println("M1 << >> M2"); // <<<< PERFECT >>>>
}
- Load frame “flag” and store the corresponding mesh in “M1”, for future verification
- Load the second frame “flag2” and store the mesh in “M2”.
- Verify that M1 is different than M2. Please note that I check both 3DS files, and have the same number of vertex, but in different positions.
flaganim = new Animation(2);
flaganim.setInterpolationMethod(Animation.LINEAR);
flaganim.createSubSequence("example");
flaganim.addKeyFrame(M1);
flaganim.addKeyFrame(M2);
flag.setAnimationSequence(flaganim);
world.addObject(flag);
world.buildAllObjects();
- Add M1 and M2 to the animation sequence “flaganim”
- Assign the animation to “flag”
- Add “flag” to WORLD
flag.animate(0, 0);
Mesh posM1 = flag.getMesh();
flag.animate(1, 0);
Mesh posM2 = flag.getMesh();
System.out.println("------------ CHECK MESH BASED ON ANIMATION -------------");
if (posM1 == posM2) {
System.out.println("posM1 = posM2"); // <<<<< THIS IS MY PROBLEM >>>>
} else {
System.out.println("posM1 << >> posM2");
}
- Calculate a new mesh for object “flag”, based on the first keyframe of its animation sequence “flag.animate (0, 0)” and save the new mesh to “posM1” for future verification.
- Re/Calculate a new mesh for object “flag”, based on the LAST (second) keyframe of its animation sequence “flag.animate (1, 0)” and save the new mesh to “posM2”.
- Compare posM1 with posM2
and they ARE EQUAL ?. For that reason the flag doesn’t move.
jPCT is calculating two same mesh, but WHY? WHAT I AM MAKING WRONG?