/// Rotate about the local up axis public void yaw(float angleDeg) { Matrix3 rotate = new Matrix3 (); rotate.setRotateAxis (this.Up, angleDeg); m_rotation.Right *= rotate; m_rotation.Forward *= rotate; }
// Rotate about "axis" through origin public void rotateWorld(Vector3 axis, float angleDeg) { Matrix3 rotate = new Matrix3 (); rotate.setRotateAxis (axis, angleDeg); m_rotation *= rotate; m_position *= rotate; }
/// Rotate about the local right axis public void pitch(float angleDeg) { Matrix3 rotate = new Matrix3 (); rotate.setRotateAxis (this.Right, angleDeg); m_rotation.Up *= rotate; m_rotation.Forward *= rotate; }
/// Rotate about "axis" through "p" public void rotateAboutPoint(Vector3 p, Vector3 axis, float angleDeg) { Matrix3 rotate = new Matrix3 (); rotate.setRotateAxis (axis, angleDeg); m_rotation *= rotate; m_position *= rotate; m_position += -p * rotate + p; }
// rotate about "axis" through "p" public static Matrix4 createRotationAboutPoint(Vector3 p, Vector3 axis, float angleDeg) { Matrix3 rotate = new Matrix3 (); rotate.setRotateAxis (axis, angleDeg); Vector3 translation = -p * rotate + p; return (new Matrix4 (rotate, translation)); }