/// <summary> /// Modifies the orientation of the camera to get the camera to look in a particular direction. /// </summary> /// <param name="direction">The direction to have the camera look.</param> public void SetDirection(Vector3 direction) { if (direction == Vector3.Zero) { return; } Vector3 zvec = -direction.NormalizeV(); Vector3 xvec = zvec.Up().CrossProduct(zvec).NormalizeV(); Vector3 yvec = zvec.CrossProduct(xvec).NormalizeV(); CenterOfInterest = QuaternionNew.FromAxis(xvec, yvec, zvec); }
/// <summary> /// Rotates the camera around a specific axis. /// </summary> /// <param name="angle">The amount to rotate the camera.</param> /// <param name="axis">The axis about which the rotation occurs.</param> public void Rotate(float angle, Vector3 axis) { Rotate(QuaternionNew.FromAngleAxis(angle, axis)); }
/// <summary> /// Rotates the camera by a supplied rotation quaternion. /// </summary> /// <param name="rotation">The amount to rotate the camera by.</param> public void Rotate(QuaternionNew rotation) { CenterOfInterest = rotation * centerOfInterest; }