So I’m working on a project where the player object is controlled by a ClientNetworkTransform (and are client authoritative) and everything else is controlled by the server with a regular NetworkTransform.
I’m trying to figure out how I can move a player over a large distance without interpolation of their position being done on any of the other clients.
I have tried clientNetworkTransform.Teleport(position, rotation, Vector3.one); on the owning player object.
I have tried setting clientNetworkTransform.Interpolate = false on all the clients
I’m not sure what I am missing. Thanks in advance
Anyone have a work around If I can’t disable interpolation at runtime?
So apparently this is a known issue
opened 07:58AM - 06 Apr 22 UTC
closed 07:33PM - 22 Aug 22 UTC
type:bug
stat:backlog
priority:low
stat:imported
### Description
I am using Netcode 1.0.0-pre.6 Version.
In my project, Pla… yer prefab is using NetworkClientTransform for moving.
When player tried to teleport using Teleport() Method, player position was interpolated.
For this reason, unity3d OnTriggerEnter/Stay/Exit events in all travel paths are triggered.
How to find a way can teleport owned network object of individual clients without interpolation?
### Reproduce Steps
1. Include NetworkClientTransform to network player.
2. Use teleport member method of NetworkClientTransform in script.
### Actual Outcome
Network object (owned player) was teleported location with interpolation.
### Expected Outcome
Need a way NetworkClientTransform can teleport without interpolation.
### Environment
- OS: Windows 10
- Unity Version: 2020.3.30f1
- Netcode Version: 1.0.0-pre.6 (all version happend)
- Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]
### Additional Context
It happens to both the server and the client.
It happens even if you play alone.
public static class NetworkTransformExtensions
{
public static void PatchedTeleport(this NetworkTransform self, Vector3 newPosition, Quaternion newRotation, Vector3 newScale)
{
self.Teleport(newPosition, newRotation, newScale);
self.StartCoroutine(PreventTeleportingStateFromBeingOverriddenAndClampInterpolation());
IEnumerator PreventTeleportingStateFromBeingOverriddenAndClampInterpolation()
{
self.enabled = false;
yield return null;
self.Teleport(newPosition, newRotation, newScale);
yield return new WaitForSecondsRealtime(0.5f);
self.enabled = true;
}
}
}
A work around