I have created a damaged plane flying animation. I have done with the help of modifiers like this:
PhysicsHandler ph = new PhysicsHandler(face);
ph.setVelocityX(100);
float time = 1f;
float d = 60f;
float angle = 5f;
MoveYModifier m1 = new MoveYModifier(time*0.8f, face.getY(), face.getY()+d);
DelayModifier dm1 = new DelayModifier(time*0.2f);
MoveYModifier m2 = new MoveYModifier(time*0.8f, face.getY()+d, face.getY());
DelayModifier dm2 = new DelayModifier(time*0.2f);
RotationModifier r1 = new RotationModifier(0.4f, 0, angle);
DelayModifier rd1 = new DelayModifier(0.2f);
RotationModifier r2 = new RotationModifier(0.4f, angle, 0);
RotationModifier r3 = new RotationModifier(0.4f, 0, -angle);
DelayModifier rd2 = new DelayModifier(0.2f);
RotationModifier r4 = new RotationModifier(0.4f, -angle, 0);
SequenceEntityModifier rotateSeq = new SequenceEntityModifier(r1,rd1,r2,r3,rd2,r4);
SequenceEntityModifier moveSeq = new SequenceEntityModifier(m1,dm1,m2,dm2);
ParallelEntityModifier pm = new ParallelEntityModifier(moveSeq,rotateSeq);
face.registerUpdateHandler(ph);
face.registerEntityModifier(new LoopEntityModifier(pm));
scene.getLastChild().attachChild(face);
I know its complicated. But the idea of the code is to give it a sinusoidal movement depicting slight rotation as well. Is there a better way to do it. Please help!
-Fanatic
