/**
  * Sets an object to animate. The object's index is <code>index</code> and it's parent index is
  * <code>parentIndex</code>. A parent index of -1 indicates it has no parent.
  *
  * @param objChange The spatial that will be updated by this SpatialTransformer.
  * @param index The index of that spatial in this transformer's array
  * @param parentIndex The parentIndex in this transformer's array for this Spatial
  */
 public void setObject(Spatial objChange, int index, int parentIndex) {
   toChange[index] = objChange;
   pivots[index].setTranslation(objChange.getLocalTranslation());
   pivots[index].setScale(objChange.getLocalScale());
   pivots[index].setRotationQuaternion(objChange.getLocalRotation());
   parentIndexes[index] = parentIndex;
 }
예제 #2
0
  /**
   * Configurable method to print information about an object.
   *
   * @param toUse
   * @param s
   * @param recursive
   * @param translation
   * @param rotation
   * @param scale
   */
  public static void printInformation(
      Logger toUse,
      Spatial s,
      boolean recursive,
      boolean translation,
      boolean rotation,
      boolean scale) {
    logger.info(s.getClass().getSimpleName() + ": " + s.getName());
    if (translation)
      toUse.info(
          s.getName()
              + " Translation: "
              + s.getLocalTranslation().x
              + ","
              + s.getLocalTranslation().y
              + ","
              + s.getLocalTranslation().z);
    if (rotation) {
      float[] angles = s.getLocalRotation().toAngles(null);
      toUse.info(s.getName() + " Rotation: " + angles[0] + "," + angles[1] + "," + angles[2]);
    }
    if (scale)
      toUse.info(
          s.getName()
              + " Scale: "
              + s.getLocalScale().x
              + ","
              + s.getLocalScale().y
              + ","
              + s.getLocalScale().z);

    if (recursive) {
      if (s instanceof Node) {
        if (((Node) s).getQuantity() > 0) {
          for (Spatial child : ((Node) s).getChildren()) {
            printInformation(toUse, child, recursive, translation, rotation, scale);
          }
        }
      }
    }
  }