In my realtime MMO game. On the server, the player can rotate to an angle facing to my mouse with an easing effect. So it has a current rotation (CR) and a future rotation (FR), the CR will interpolate to the FR during an update on the server. This works perfectly if I put the code on client side without a network environment. I can interpolate the angle from current rotation to the future rotation of the player.
However in my current settings, when I do an interpolation based on the information received from the server, I am interpolating from the player's previous received rotation to its latest received rotation which both are CRs. The interpolation works fine but it doesn't reflect accurately what the server is doing because this interpolation doesn't use FR at all. It is just grabbing the data from the network and interpolating the two CRs. In reality it has easing effect but it is responding to the rotation event very slowly then suddenly change its direction. I want to implement a client-side interpolation with future rotation data coming from the server but not sure how to do it.
My current working code is like this:
shortestAngle = (((latestCR - previousCR) % (Math.PI * 2) + Math.PI * 3) % (Math.PI * 2)) - Math.PI;
progress = shortestAngle * ratio;
interpolateRotation = progress + previousCR;
How can the future rotation fit in?