/** * Sets the up axis for this {@link ATransformable3D} object. If this is part of a scene graph, * the graph will be notified of the change. * * @param x double The x component of the new up axis. * @param y double The y component of the new up axis. * @param z double The z component of the new up axis. * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D setUpAxis(double x, double y, double z) { mUpAxis.setAll(x, y, z); if (mLookAtEnabled && mLookAtValid) { mOrientation.lookAt(mLookAt, mUpAxis); markModelMatrixDirty(); } return this; }
/** * Resets the up axis for this {@link ATransformable3D} object to the +Y 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 resetUpAxis() { mUpAxis.setAll(Vector3.getAxisVector(Vector3.Axis.Y)); if (mLookAtEnabled && mLookAtValid) { mOrientation.lookAt(mLookAt, mUpAxis); markModelMatrixDirty(); } return this; }
/** * Resets the orientation of this {@link ATransformable3D} object to look at its look at target * and use the specified {@link Vector3} as up. If this is part of a scene graph, the graph will * be notified of the change. * * @param upAxis {@link Vector3} The direction to use as the up axis. * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D resetToLookAt(Vector3 upAxis) { mTempVec.subtractAndSet(mLookAt, mPosition); // In OpenGL, Cameras are defined such that their forward axis is -Z, not +Z like we have // defined objects. if (mIsCamera) mTempVec.inverse(); mOrientation.lookAt(mTempVec, upAxis); mLookAtValid = true; markModelMatrixDirty(); return this; }