I’m using HLAPI for networking of my game and have used NetworkTransform on my characters but no matter how I change the component’s values, the movement is not smooth. Like it’s not interpolating. I see snappy movement on the local client.
I’ve written my own character controller and doesn’t use physic but has a Rigidbody 2D attached to it. I’ve tried “Sync Transform” among other settings for “Transform Sync Mode” but they don’t different much.
How can I do it whilst using HLAPI and NetworkTransform? I think I have no control over transform component’s position and it gets updated automatically over the network.
I’ve read that lerping won’t work on Sync Transform and probably that was why it was choppy/jerky. I’ve changed it to Sync Rigidbody 2D and it’s better now.
@carking1996 could you explain a little bit more about that code? What’s the difference between [ClientCallback] and [Client]? Does it work like this? Every FixedUpdate() on LocalPlayer (on client’s instance) we provide our current position to server by CmdProvide, the CmdProvide syncs that var across all the clients and when it’s changed then the hook fuction SyncPositionValues applies it on every other instance?
If you still want to use Sync Transform you can have a network transform for just the remote position and have your main gameobject lerp towards it with whatever speed/teleport settings you want. The network transform would only have debug rendering info on it that you would hide outside the editor, and your actual gameobject would follow it around, speeding up when lagging if needed or teleporting if the distance became to great. You’d have to write all the code for the lerping at that point though.