@@ -2650,7 +2650,18 @@ protected internal void ApplyAuthoritativeState()
26502650 // Update our current position if it changed or we are interpolating
26512651 if ( networkState . HasPositionChange || Interpolate )
26522652 {
2653- m_InternalCurrentPosition = adjustedPosition ;
2653+ if ( SyncPositionX && SyncPositionY && SyncPositionZ )
2654+ {
2655+ m_InternalCurrentPosition = adjustedPosition ;
2656+ }
2657+ else
2658+ {
2659+ // Preserve any non-synchronized changes to the local instance's position
2660+ var position = InLocalSpace ? transform . localPosition : transform . position ;
2661+ m_InternalCurrentPosition . x = SyncPositionX ? adjustedPosition . x : position . x ;
2662+ m_InternalCurrentPosition . y = SyncPositionY ? adjustedPosition . y : position . y ;
2663+ m_InternalCurrentPosition . z = SyncPositionZ ? adjustedPosition . z : position . z ;
2664+ }
26542665 }
26552666#if COM_UNITY_MODULES_PHYSICS || COM_UNITY_MODULES_PHYSICS2D
26562667 if ( m_UseRigidbodyForMotion )
@@ -2696,7 +2707,21 @@ protected internal void ApplyAuthoritativeState()
26962707 // Update our current rotation if it changed or we are interpolating
26972708 if ( networkState . HasRotAngleChange || Interpolate )
26982709 {
2699- m_InternalCurrentRotation = adjustedRotation ;
2710+ if ( ( SyncRotAngleX && SyncRotAngleY && SyncRotAngleZ ) || UseQuaternionSynchronization )
2711+ {
2712+ m_InternalCurrentRotation = adjustedRotation ;
2713+ }
2714+ else
2715+ {
2716+ // Preserve any non-synchronized changes to the local instance's rotation
2717+ var rotation = InLocalSpace ? transform . localRotation . eulerAngles : transform . rotation . eulerAngles ;
2718+ var currentEuler = m_InternalCurrentRotation . eulerAngles ;
2719+ var updatedEuler = adjustedRotation . eulerAngles ;
2720+ currentEuler . x = SyncRotAngleX ? updatedEuler . x : rotation . x ;
2721+ currentEuler . y = SyncRotAngleY ? updatedEuler . y : rotation . y ;
2722+ currentEuler . z = SyncRotAngleZ ? updatedEuler . z : rotation . z ;
2723+ m_InternalCurrentRotation . eulerAngles = currentEuler ;
2724+ }
27002725 }
27012726
27022727#if COM_UNITY_MODULES_PHYSICS || COM_UNITY_MODULES_PHYSICS2D
@@ -2737,7 +2762,18 @@ protected internal void ApplyAuthoritativeState()
27372762 // Update our current scale if it changed or we are interpolating
27382763 if ( networkState . HasScaleChange || Interpolate )
27392764 {
2740- m_InternalCurrentScale = adjustedScale ;
2765+ if ( SyncScaleX && SyncScaleY && SyncScaleZ )
2766+ {
2767+ m_InternalCurrentScale = adjustedScale ;
2768+ }
2769+ else
2770+ {
2771+ // Preserve any non-synchronized changes to the local instance's scale
2772+ var scale = transform . localScale ;
2773+ m_InternalCurrentScale . x = SyncScaleX ? adjustedScale . x : scale . x ;
2774+ m_InternalCurrentScale . y = SyncScaleY ? adjustedScale . y : scale . y ;
2775+ m_InternalCurrentScale . z = SyncScaleZ ? adjustedScale . z : scale . z ;
2776+ }
27412777 }
27422778 transform . localScale = m_InternalCurrentScale ;
27432779 }
0 commit comments