コード例 #1
0
 public void Switch() {
   if (i == 1) {
     mObject.transitionToAnimationSequence(mSequenceBend, 1000);
     i = 2;
   } else if (i == 2) {
     mObject.transitionToAnimationSequence(mSequenceArmStretch, 1000);
     i = 3;
   } else if (i == 3) {
     mObject.transitionToAnimationSequence(mSequenceIdle, 1000);
     i = 4;
   } else if (i == 4) {
     mObject.transitionToAnimationSequence(mSequenceWalk, 1000);
     i = 1;
   }
 }
コード例 #2
0
  protected void initScene() {
    mLight = new DirectionalLight(0, -0.2f, -1.0f); // set the direction
    mLight.setColor(1.0f, 1.0f, .8f);
    mLight.setPower(1);

    getCurrentScene().addLight(mLight);
    getCurrentCamera().setZ(dist);

    try {
      LoaderMD5Mesh meshParser = new LoaderMD5Mesh(this, R.raw.ingrid_mesh);
      meshParser.parse();

      LoaderMD5Anim animParser = new LoaderMD5Anim("idle", this, R.raw.ingrid_idle);
      animParser.parse();

      mSequenceIdle = (SkeletalAnimationSequence) animParser.getParsedAnimationSequence();

      animParser = new LoaderMD5Anim("walk", this, R.raw.ingrid_walk);
      animParser.parse();

      mSequenceWalk = (SkeletalAnimationSequence) animParser.getParsedAnimationSequence();

      animParser = new LoaderMD5Anim("armstretch", this, R.raw.ingrid_arm_stretch);
      animParser.parse();

      mSequenceArmStretch = (SkeletalAnimationSequence) animParser.getParsedAnimationSequence();

      animParser = new LoaderMD5Anim("bend", this, R.raw.ingrid_bend);
      animParser.parse();

      mSequenceBend = (SkeletalAnimationSequence) animParser.getParsedAnimationSequence();

      mObject = (SkeletalAnimationObject3D) meshParser.getParsedAnimationObject();
      mObject.setAnimationSequence(mSequenceWalk);
      mObject.setFps(24);
      mObject.setScale(.8f);
      mObject.play();

      addChild(mObject);
    } catch (ParsingException e) {
      e.printStackTrace();
    }
  }
コード例 #3
0
 @Override
 public void onDrawFrame(GL10 glUnused) {
   super.onDrawFrame(glUnused);
   getCurrentCamera().setZ(dist);
   // mObject.setRotation(mAccValues.x, mAccValues.y, mAccValues.z);
   getCurrentCamera().setZ(dist);
   if (direction == 1) mObject.setRotY(mObject.getRotY() - 2);
   else if (direction == 2) mObject.setRotY(mObject.getRotY() + 2);
   else if (direction == 3) mObject.setRotX(mObject.getRotX() - 2);
   else if (direction == 4) mObject.setRotX(mObject.getRotX() + 2);
 }