Created
October 11, 2020 14:26
-
-
Save webmonch/b1fba8f11297f30c5181868711925ceb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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