@@ -587,26 +587,26 @@ protected virtual void SetLocalTransform(Vector3 newPosition, Quaternion newRota
587587 var positionValid = m_IgnoreTrackingState || ( m_CurrentTrackingState & TrackingStates . Position ) != 0 ;
588588 var rotationValid = m_IgnoreTrackingState || ( m_CurrentTrackingState & TrackingStates . Rotation ) != 0 ;
589589
590- #if HAS_SET_LOCAL_POSITION_AND_ROTATION
591- if ( m_TrackingType == TrackingType . RotationAndPosition && rotationValid && positionValid )
590+ switch ( m_TrackingType )
592591 {
593- transform . SetLocalPositionAndRotation ( newPosition , newRotation ) ;
594- return ;
595- }
596- #endif
597-
598- if ( rotationValid &&
599- ( m_TrackingType == TrackingType . RotationAndPosition ||
600- m_TrackingType == TrackingType . RotationOnly ) )
601- {
602- transform . localRotation = newRotation ;
603- }
604-
605- if ( positionValid &&
606- ( m_TrackingType == TrackingType . RotationAndPosition ||
607- m_TrackingType == TrackingType . PositionOnly ) )
608- {
609- transform . localPosition = newPosition ;
592+ case TrackingType . RotationAndPosition :
593+ if ( rotationValid && positionValid )
594+ transform . SetLocalPositionAndRotation ( newPosition , newRotation ) ;
595+ else if ( rotationValid )
596+ transform . localRotation = newRotation ;
597+ else
598+ transform . localPosition = newPosition ;
599+ break ;
600+
601+ case TrackingType . PositionOnly :
602+ if ( positionValid )
603+ transform . localPosition = newPosition ;
604+ break ;
605+
606+ case TrackingType . RotationOnly :
607+ if ( rotationValid )
608+ transform . localRotation = newRotation ;
609+ break ;
610610 }
611611 }
612612
0 commit comments