Is there a way to temporarily disable interpolation in the NetworkTransform component? I have teleportation points in the game space and when the transform position is changed in the player game object, the client version of the avatar gets interpolated through the game space rather than jumping to the final position in one frame. In general, I want interpolation to be enabled, since it smooths out the avatar motion in the client.
I have tried to set the “Interpolate” value directly in code. I’m able to set the initial avatar position successfully without interpolation. However, when I hit one of the teleportation points, the avatar is interpolated even after setting the value to false.
I just found the “NetworkTransform.Teleport()” method, which seems like it’s what I’m looking for. However, the client is still interpolating the location. I’m running “Teleport()” from the server presently. I’m not certain where it should be run from. I’ll try it in the client next.
I tried “NetworkTransform.Teleport()” from the client and received an exception stating “Teleport not allowed”. I’m not surprised. It seems like it should be happening on the server side and then synced to the clients.
Running “NetworkTransform.Teleport()” does move the player avatar to the desired location, but the client is definitely interpolating. I’ve looked over the source code and it’s clear that interpolation is not intended. Does anyone know of a workaround?
It looks like this problem has already been logged as a bug in the Netcode for GameObjects Git repository…
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/1867
2 Likes
Thanks for sharing, link solved my problem.