/**
   * Centers the spatial in the origin of the world bound.
   *
   * @return The spatial on which this method is called, e.g <code>this</code>.
   */
  public Spatial center() {
    Vector3f worldTrans = getWorldTranslation();
    Vector3f worldCenter = getWorldBound().getCenter();

    Vector3f absTrans = worldTrans.subtract(worldCenter);
    setLocalTranslation(absTrans);

    return this;
  }
Exemple #2
0
  public Vector3f transformInverseVector(final Vector3f in, Vector3f store) {
    if (store == null) store = new Vector3f();

    // The author of this code should look above and take the inverse of that
    // But for some reason, they didnt ..
    //        in.subtract(translation, store).divideLocal(scale);
    //        rot.inverse().mult(store, store);

    in.subtract(translation, store);
    rot.inverse().mult(store, store);
    store.divideLocal(scale);

    return store;
  }