I'm trying animation keyframe, but my object stand still.
Why?
What is the problem?
Can you help me, please?
Why?
Code Select
thing = loadModel(R.raw.omino_1, 1f);
Animation anim = new Animation(4);
anim.createSubSequence("idle");
anim.addKeyFrame(thing.getMesh());
anim.createSubSequence("walk");
anim.addKeyFrame(loadModel(R.raw.omino_1, 1f).getMesh());
anim.addKeyFrame(loadModel(R.raw.omino_2, 1f).getMesh());
anim.addKeyFrame(loadModel(R.raw.omino_3, 1f).getMesh());
thing.setAnimationSequence(anim);
world.addObject(thing);
...
Code Select
private Object3D loadModel(int objId, float scale) {
Resources res = getResources();
Object3D[] model = Loader.load3DS(res.openRawResource(objId), scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float)( -.5*Math.PI));
temp.rotateMesh();
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);
o3d.build();
}
return o3d;
}
Code Select
public void doAnim() {
ind += 0.1f;
if (ind >= 1f) {
ind = 0;
}
Logger.log("frame: "+ind);
thing.animate(ind, thing.getAnimationSequence().getSequence("walk"));
}
What is the problem?
Can you help me, please?