How to deal with fast rotating player objects.

I am working on a game where players fly airplanes. Each plane has a Photon View with a custom script connected to send and receive data using OnPhotonSerializeView

I am pretty much using the Photon Lag compensation example code.

The positions are adjusted on the calculated lag and then lerped.
float lag = Mathf.Abs((float) (PhotonNetwork.Time - info.timestamp));
rigidbody.position += rigidbody.velocity * lag; 

The problem comes with the rotation in the fixed update.
rigidbody.rotation = Quaternion.RotateTowards(rigidbody.rotation, networkRotation, Time.fixedDeltaTime * 100.0f);
If a player is rolling his plane fast enough (in one direction), it happens that the new networkRotation is closer to rotate to in reverse. This causes the plane not to roll, but just rock back and forth on the other player's screens.

I can set the rotation of the plane to the network rotation or increase the maxRadiansDelta (100f), but that makes the planes very jittery. I can also increase the sendRate, but I am already feeling that its pretty high at the moment.
PhotonNetwork.SendRate = 15;
PhotonNetwork.SerializationRate = 15;

Does anybody have a suggestion on how to approach this problem ? The objects need to rotate fast enough and still be smoothed.

Best Answer

Answers