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

NetworkTransform.Teleport client-side interpolation issue

Open NoelStephensUnity opened this issue 3 years ago • 1 comments

Description

When using a server authoritative NetworkTransform model while also using NetworkRigidbody and Rigidbody, if you attempt to teleport a NetworkObject from one location to the next the client-side will interpolate from a position close to the source teleport location and will interpolate to the destination location.

Reproduce Steps

  1. Create a project where you have dynamically spawned objects from a NetworkPrefabHandler pool
  2. Make sure the spawned object's NetworkTransform can have its interpolation toggled on/off (user key intput etc)
  3. Start a host and at least one additional client
  4. Teleport spawned NetworkObjects from location A to location B (make them relatively far from each other)
  5. While teleporting, turn interpolation on and note how the client-side will appear at location B briefly but will then "warp back" close to location A and interpolate to location B.

Actual Outcome

It appears that just waiting 1 frame is not enough to properly teleport NetworkObjects and clients will see the teleported object interpolate from location A to location B

Expected Outcome

When teleporting NetworkObjects, there should be a way to completely clear out the interpolation history in order to prevent this from happening.

Project

Project where you can see this happen

Environment

  • OS: Windows 10
  • Unity Version: 2021.2.10f1
  • Netcode Version: 1.0.0-pre.7

NoelStephensUnity avatar Apr 11 '22 15:04 NoelStephensUnity

MTT-3458

ashwinimurt avatar May 03 '22 23:05 ashwinimurt

This is already fixed.

ashwinimurt avatar Aug 22 '22 18:08 ashwinimurt

Fixed in https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/2110/ on develop

ashwinimurt avatar Aug 22 '22 18:08 ashwinimurt