Rotation sync over network best practices (especially; direction)
Hey all! I'm looking for advice on how would one sync rotation sent over photon (or any network) near perfect. Currently, when an object turns faster than the network can send messages, the object on the other side just rotates to the last point using the closest route. An example case is this:
Client1 turns a specific direction and sends the euler angles to Client 2
Message 1: (0,0,20)
Message 2: (0,0,320)
Once the client2 receives the second message, as normally I would expect the to turn 300 degrees in positive direction but it only uses the fastest route to 320 which is -60 degrees and does not result in a correct implementation. The script receives the message and then uses Quaternion.Lerp to reach the received rotation.
So, how would I go about syncing the rotation correctly, or at least close to correct? For example, would it be possible to calculate a direction mathematically before sending or after receiving the rotation of the object? Or should a different approach should be used altogether? Maybe I could store rotation at each 10 units between every message and send it as a list of vector3s rather than one vector3 while I do not even know if it's actually possible. Could anyone point me to a good direction? I know quaternions are a hell to deal with but still, I feel like there should be a way to do this logically.
Your answer
![](https://koobas.hobune.stream/wayback/20220612185535im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to change Player rotation towards nearest other Player? 0 Answers
Cancel out the steering rotation returned from a wheel colliders .GetWorldPose(out pos, out rot); 1 Answer
Photon Bolt: is it a viable solution for a game with a high cheating potential? 1 Answer
How to limit only one axis rotation? c# 1 Answer
How can I fix rotation of Z axis to 0? 0 Answers