示例#1
0
  /*
   * Index represents the index of the joint (zero is the bottom joint)
   */
  public Joint(
      ActorNode actorNode,
      Joint prev,
      float x,
      float y,
      float z,
      float a,
      float b,
      float c,
      float d,
      JointPhysics physics,
      GlobalPhysics globalPhysics) {
    mActorNode = actorNode;
    mPhysics = physics;
    mGlobalPhysics = globalPhysics;
    y = 0;
    z = 0;

    mPrev = prev;
    mOriginalRotation.set(a, b, c, d);
    mRotation.set(a, b, c, d, false);
    mWorldRotation.set(a, b, c, d); // Only correct for root (others will be set on first update)
    // mDirection.set(.075f, 0f, 0f);
    mDirection.set(physics.mSpringLength, 0f, 0f);
    // mDirection.set(.05f + (float)Math.random() * 0.1f, 0f, 0f);
    mOrthogonalTarget = mOriginalRotation.applyTo(BONE_ORTH);
    if (prev != null) {
      prev.mSimulate = true;
      mPrev.mWorldEndPosition.set(x, y, z);
      Vec3 dir = new Vec3(x, y, z);
      if (dir.getLength() > 0.001f) {
        // mPrev.mDirectionVector.set(x, y, z);
        mPrev.mOrthogonalTarget = mPrev.mOriginalRotation.applyTo(BONE_ORTH);
      }
    }
    while (prev != null) {
      prev.mRootiness += 1f;
      prev = prev.mPrev;
    }
  }