public void setSensorOrientation(float[] quaternion) { synchronized (mCameraOrientationLock) { mCameraOrientation.x = quaternion[1]; mCameraOrientation.y = quaternion[2]; mCameraOrientation.z = quaternion[3]; mCameraOrientation.w = quaternion[0]; mScratchQuaternion1.fromAngleAxis(Axis.X, -90); mScratchQuaternion1.multiply(mCameraOrientation); mScratchQuaternion2.fromAngleAxis(Axis.Z, -90); mScratchQuaternion1.multiply(mScratchQuaternion2); mCameraOrientation.setAll(mScratchQuaternion1); } }
/** * Gets the current orientation of this {@link ATransformable3D} object. * * @param quat {@link Quaternion} To copy the orientation into. * @return The provided {@link Quaternion} to facilitate chaining. */ public Quaternion getOrientation(Quaternion quat) { quat.setAll(mOrientation); return quat; }
public void setCameraOrientation(Quaternion cameraOrientation) { synchronized (mCameraOrientationLock) { mCameraOrientation.setAll(cameraOrientation); } }
/** * Sets the orientation of this {@link ATransformable3D} object. * * @param quat {@link Quaternion} to copy the orientation from. The values of this object are * copied and the passed object is not retained. * @return A reference to this {@link ATransformable3D} to facilitate chaining. */ public ATransformable3D setOrientation(Quaternion quat) { mOrientation.setAll(quat); mLookAtValid = false; markModelMatrixDirty(); return this; }