Skip to content

Commit dbcabe8

Browse files
fix
Make sure to initialize based on whether it is set to world or local space.
1 parent 7c4550e commit dbcabe8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

com.unity.netcode.gameobjects/Components/NetworkTransform.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,12 @@ private void ResetInterpolatedStateToCurrentAuthoritativeState()
547547
// NOTE ABOUT THIS CHANGE:
548548
// !!! This will exclude any scale changes because we currently do not spawn network objects with scale !!!
549549
// Regarding Scale: It will be the same scale as the default scale for the object being spawned.
550-
m_PositionXInterpolator.ResetTo(transform.position.x, serverTime);
551-
m_PositionYInterpolator.ResetTo(transform.position.y, serverTime);
552-
m_PositionZInterpolator.ResetTo(transform.position.z, serverTime);
553-
554-
m_RotationInterpolator.ResetTo(transform.rotation, serverTime);
550+
var position = InLocalSpace ? transform.localPosition : transform.position;
551+
m_PositionXInterpolator.ResetTo(position.x, serverTime);
552+
m_PositionYInterpolator.ResetTo(position.y, serverTime);
553+
m_PositionZInterpolator.ResetTo(position.z, serverTime);
554+
var rotation = InLocalSpace ? transform.localRotation : transform.rotation;
555+
m_RotationInterpolator.ResetTo(rotation, serverTime);
555556

556557
// TODO: (Create Jira Ticket) Synchronize local scale during NetworkObject synchronization
557558
// (We will probably want to byte pack TransformData to offset the 3 float addition)

0 commit comments

Comments
 (0)