NetworkRotation









How do I use Network Rotation
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PhotonTransformViewRotationControl.cs Copy
14     public Quaternion GetRotation( Quaternion currentRotation )
15     {
16         switch( m_Model.InterpolateOption )
17         {
18         default:
19         case PhotonTransformViewRotationModel.InterpolateOptions.Disabled:
20             return m_NetworkRotation;
21         case PhotonTransformViewRotationModel.InterpolateOptions.RotateTowards:
22             return Quaternion.RotateTowards( currentRotation, m_NetworkRotation, m_Model.InterpolateRotateTowardsSpeed * Time.deltaTime );
23         case PhotonTransformViewRotationModel.InterpolateOptions.Lerp:
24             return Quaternion.Lerp( currentRotation, m_NetworkRotation, m_Model.InterpolateLerpSpeed * Time.deltaTime );
25         }
26     }
File name: PhotonTransformViewRotationControl.cs Copy
28     public void OnPhotonSerializeView( Quaternion currentRotation, PhotonStream stream, PhotonMessageInfo info )
29     {
30         if( m_Model.SynchronizeEnabled == false )
31         {
32             return;
33         }
34
35         if( stream.isWriting == true )
36         {
37             stream.SendNext( currentRotation );
38         }
39         else
40         {
41             m_NetworkRotation = (Quaternion)stream.ReceiveNext();
42         }
43     }

NetworkRotation 135 lượt xem

Gõ tìm kiếm nhanh...