public void Rotate( Quaternion qnorm ) { // Note the order of the mult, i.e. q comes after // Normalise the quat to avoid cumulative problems with precision qnorm.Normalize(); this.orientation = qnorm*this.orientation; InvalidateView(); }
/// <summary> /// Rotate the node around an arbitrary axis using a Quaternion. /// </summary> public virtual void Rotate( Quaternion rotation, TransformSpace relativeTo ) { rotation.Normalize(); // avoid drift switch ( relativeTo ) { case TransformSpace.Parent: // Rotations are normally relative to local axes, transform up orientation = rotation * orientation; break; case TransformSpace.World: orientation = orientation * DerivedOrientation.Inverse() * rotation * DerivedOrientation; break; case TransformSpace.Local: // Note the order of the mult, i.e. q comes after orientation = orientation * rotation; break; } NeedUpdate(); }