Skip to content

Instantly share code, notes, and snippets.

@webmonch
Created October 11, 2020 14:26
Show Gist options
  • Save webmonch/b1fba8f11297f30c5181868711925ceb to your computer and use it in GitHub Desktop.
Save webmonch/b1fba8f11297f30c5181868711925ceb to your computer and use it in GitHub Desktop.
// Updated method in PhotonTransformViewRotationControl.cs
public void OnPhotonSerializeView( Quaternion currentRotation, PhotonStream stream, PhotonMessageInfo info )
{
if( m_Model.SynchronizeEnabled == false )
{
return;
}
if( stream.isWriting == true )
{
var y = currentRotation.eulerAngles.y;
var qy = (byte)((y * 255) / 360);
stream.SendNext( qy );
m_NetworkRotation = currentRotation;
}
else
{
var qy = (byte)stream.ReceiveNext();
var y = (qy * 360) / 255f;
var rot = Quaternion.AngleAxis(y, Vector3.up);
m_NetworkRotation = rot;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment