I’ve been trying to understand how CMC interpolates server location and client location for two days. I am willing to replace CMC with UFloatingPawnMovement, but since it is not replicated, only thing I can do is enabling bReplicateMovement and interpolate client’s position to server position. I understand the theory and how it is working, but I dont understand how I should setup the system/code.
In here, Zak explains two ways to do this, first one is using RPCs on Tick and interpolating yourself. And other (also most performant one) is using CMC way. I tried to implement CMC way, but since CMC is already too complex for someone just started networking, I am unable to solve the interpolation code by myself.
This is what I’ve done:
There are at least 10+ threads/questions related to this topic on both forums and answers.unrealengine.com but none of them giving a clear solution. Most of them is about physics replication, there are some few threads about non-physics movement replication, and most useful one is the one I’ve dropped above. I dont understand where “MeshTranslationOffset” should come from, or why we are doing this:
FVector NewRelTranslation = GetComponentToWorld().InverseTransformDirection(MeshTranslationOffset) + DefaultMeshOffset; (this method is old and seems like deprecated btw)
And seems like bReplicateMovement already teleports both root and child components together, I dont understand how should lerping or changing relative location work.
Video link: Screen Recording 2020-12-19 at 11.55.49 ÖÖ (jumpshare link, alternative to gyazo, its safe.)
In that video, I have the code I’ve provided with pastebin. I know I am missing a lot of things, if someone can guide me, I would be glad.