3D Animation with 3DS from Blender

Started by loongy, March 15, 2011, 03:51:25 PM

Previous topic - Next topic

loongy

I have 3ds model exported from blender and when i put it into jpct ae no errors came out but it didnt animate? i followed code to the word from other posts and cannot figure out what is wrong?
i then decided to export each animation individually and ended up with several different 3ds models and when i used their meshes as animation keyframes and applied all the key frames etc still no result? the object just sits there without animating.

animationArray.add(Loader.load3DS(getAssets().open("test1.3ds"), 15.0f)[0]);
animationArray.add(Loader.load3DS(getAssets().open("test2.3ds"), 15.0f)[0]);
animationArray.add(Loader.load3DS(getAssets().open("test3.3ds"), 15.0f)[0]);
man = new WorldObject(animationArray.get(1));
man.setOrigin(new SimpleVector(0, 0, 0));
man.build();
man.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
man.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);

Animation anim = new Animation(animationArray.size());
anim.createSubSequence("walk");
for (int i = 0; i < animationArray.size(); i++) {
System.out.println("adding keyframe number " + i);
Object3D obj = animationArray.get(i);
obj.build();
Mesh msh = obj.getMesh().cloneMesh(true);
msh.strip();
anim.addKeyFrame(msh);
}
man.setAnimationSequence(anim);
man.build();


and then the animation called every frame. this is inside and extended class of Object3D (thus the this.animate(ind, an));


public void runAnimation() {
try{
            ind += 0.02f;
            if (ind > 1f) {
                ind -= 1f;
            }
            this.animate(ind, an);
}catch(Exception e){
System.err.println("MoveTest::checkAnimate3DS() " + e.getMessage());
e.printStackTrace();
}
}


EgonOlsen

You are calling build() twice on your objects. The first call happens before assigning the animation, so the object is put into static mode. The second can't change that anymore. Try to remove the first call and see if that helps.

loongy

This doesn't work. LogCat gives me:

RunTimeException - ERROR: The sizes of the Animations Meshes (16) and the object's Mesh (8) don't match!

what does this mean? and why is it happening?

EgonOlsen

It means that they don't match. Try to do a call to Loader.setVertexOptimization(false); before loading the meshes. If it still doesn't work, your meshes are not using an equal vertex count.