Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ciropan

Pages: [1]
1
Support / keyframe animation
« on: February 05, 2012, 01:49:50 pm »
I'm trying animation keyframe, but my object stand still.
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?

Pages: [1]