/** * Enables auto-enforcement of look at target, and orients to look at the current target. */ public void enableLookAt() { mLookAtEnabled = true; resetToLookAt(); }
/** * Resets the orientation of this {@link ATransformable3D} object to look at its look at * target and use the current up axis. If this is part of a scene graph, the graph * will be notified of the change. * * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D resetToLookAt() { resetToLookAt(mUpAxis); return this; }
/** * Sets the x component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param x double The new x component for the position. */ public void setX(double x) { mPosition.x = x; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the y component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param y double The new y component for the position. */ public void setY(double y) { mPosition.y = y; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the z component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param z double The new z component for the position. */ public void setZ(double z) { mPosition.z = z; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Orients this {@link ATransformable3D} object to 'look at' the specified point. * If this is part of a scene graph, the graph will be notified of the change. * * @param x {@code double} The look at target x coordinate. * @param y {@code double} The look at target y coordinate. * @param z {@code double} The look at target z coordinate. * * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D setLookAt(double x, double y, double z) { mLookAt.x = x; mLookAt.y = y; mLookAt.z = z; resetToLookAt(); markModelMatrixDirty(); return this; }
/** * Sets the position of this {@link ATransformable3D}. If this is * part of a scene graph, the graph will be notified of the change. * * @param position {@link Vector3} The new position. This is copied * into an internal store and can be used after this method returns. */ public void setPosition(Vector3 position) { mPosition.setAll(position); if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Orients this {@link ATransformable3D} object to 'look at' the specified point. * If this is part of a scene graph, the graph will be notified of the change. * * @param lookAt {@link Vector3} The look at target. Must not be null. * * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D setLookAt(Vector3 lookAt) { if (lookAt == null) { throw new IllegalArgumentException("As of Rajawali v0.10, you cannot set a " + "null look target. If you want to remove the look target, use " + "clearLookAt(boolean) instead."); } mLookAt.setAll(lookAt); resetToLookAt(); markModelMatrixDirty(); return this; }
/** * Sets the position of this {@link ATransformable3D}. If this is * part of a scene graph, the graph will be notified of the change. * * @param x double The x coordinate new position. * @param y double The y coordinate new position. * @param z double The z coordinate new position. */ public void setPosition(double x, double y, double z) { mPosition.setAll(x, y, z); if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Utility method to move the specified number of units along the current forward axis. This will * also adjust the look at target (if a valid one is currently set). * * @param units {@code double} Number of units to move. If negative, movement will be in the "back" direction. */ public void moveForward(double units) { mTempVec.setAll(WorldParameters.FORWARD_AXIS); mTempVec.rotateBy(mOrientation).normalize(); mTempVec.multiply(units); mPosition.add(mTempVec); if (mLookAtEnabled && mLookAtValid) { mLookAt.add(mTempVec); resetToLookAt(); } markModelMatrixDirty(); }
/** * Utility method to move the specified number of units along the current up axis. This will * also adjust the look at target (if a valid one is currently set). * * @param units {@code double} Number of units to move. If negative, movement will be in the "down" direction. */ public void moveUp(double units) { mTempVec.setAll(WorldParameters.UP_AXIS); mTempVec.rotateBy(mOrientation).normalize(); mTempVec.multiply(units); mPosition.add(mTempVec); if (mLookAtEnabled && mLookAtValid) { mLookAt.add(mTempVec); resetToLookAt(); } markModelMatrixDirty(); }
/** * Utility method to move the specified number of units along the current right axis. This will * also adjust the look at target (if a valid one is currently set). * * @param units {@code double} Number of units to move. If negative, movement will be in the "left" direction. */ public void moveRight(double units) { mTempVec.setAll(WorldParameters.RIGHT_AXIS); mTempVec.rotateBy(mOrientation).normalize(); mTempVec.multiply(units); mPosition.add(mTempVec); if (mLookAtValid) { mLookAt.add(mTempVec); resetToLookAt(); } markModelMatrixDirty(); }
/** * Enables auto-enforcement of look at target, and orients to look at the current target. */ public void enableLookAt() { mLookAtEnabled = true; resetToLookAt(); }
/** * Resets the orientation of this {@link ATransformable3D} object to look at its look at * target and use the current up axis. If this is part of a scene graph, the graph * will be notified of the change. * * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D resetToLookAt() { resetToLookAt(mUpAxis); return this; }
/** * Sets the y component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param y double The new y component for the position. */ public void setY(double y) { mPosition.y = y; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the x component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param x double The new x component for the position. */ public void setX(double x) { mPosition.x = x; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the z component of the position for this {@link ATransformable3D}. * If this is part of a scene graph, the graph will be notified of the change. * * @param z double The new z component for the position. */ public void setZ(double z) { mPosition.z = z; if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the position of this {@link ATransformable3D}. If this is * part of a scene graph, the graph will be notified of the change. * * @param x double The x coordinate new position. * @param y double The y coordinate new position. * @param z double The z coordinate new position. */ public void setPosition(double x, double y, double z) { mPosition.setAll(x, y, z); if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Sets the position of this {@link ATransformable3D}. If this is * part of a scene graph, the graph will be notified of the change. * * @param position {@link Vector3} The new position. This is copied * into an internal store and can be used after this method returns. */ public void setPosition(Vector3 position) { mPosition.setAll(position); if (mLookAtEnabled && mLookAtValid) resetToLookAt(); markModelMatrixDirty(); }
/** * Utility method to move the specified number of units along the current up axis. This will * also adjust the look at target (if a valid one is currently set). * * @param units {@code double} Number of units to move. If negative, movement will be in the "down" direction. */ public void moveUp(double units) { mTempVec.setAll(WorldParameters.UP_AXIS); mTempVec.rotateBy(mOrientation).normalize(); mTempVec.multiply(units); mPosition.add(mTempVec); if (mLookAtEnabled && mLookAtValid) { mLookAt.add(mTempVec); resetToLookAt(); } markModelMatrixDirty(); }