com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Calling SetParent causes NetworkObject to have an incorrect position on clients.

Open qjonathan opened this issue 1 year ago • 1 comments

Description

With interpolation enabled when the server changes the parent of a NetworkObject the position on the clients is wrong for 1 frame.

Reproduce Steps

With interpolation enabled on the NetworkTransform

  1. Player A goes next to NetworkObject,
  2. The server attach the networkobject to Player A by calling SetParent,
  3. On the Client(Player B) the NetworkObject position is now wrong.

Expected Outcome

We did not have that issue when using 1.2.0, we just updated to 1.9.1 and one of the gameplay mechanics suddenly started acting weird. Disabling interpolation seems to fix the issue but will cause the visuals to be less smooth

Environment

  • OS: Windows
  • Unity Version: 2022.3.30f
  • Netcode Version: 1.9.1

qjonathan avatar Jun 21 '24 00:06 qjonathan

@qjonathan Could you provide a replication of this issue and/or provide the code snippet(s) that handles the parenting? It might be that you want to not keep the world position (i.e. WorldPositionStays = false) and switch the child over to local space when parenting....but a working replication project would help me better understand your issue.

NoelStephensUnity avatar Jul 14 '24 19:07 NoelStephensUnity

@qjonathan Have you updated to NGO v1.11.0 and if so are you still seeing this issue?

NoelStephensUnity avatar Dec 11 '24 17:12 NoelStephensUnity

I will close this issue since it should be fixed but feel free to comment if you will notice that it's still there

michalChrobot avatar Feb 19 '25 12:02 michalChrobot