// serialization is needed by OnSerialize and by manual sending from authority
 // public only for tests
 public static void SerializeIntoWriter(NetworkWriter writer, Vector3 position, Quaternion rotation, Vector3 scale)
 {
     // serialize position, rotation, scale
     // => compress rotation from 4*4=16 to 4 bytes
     // => less bandwidth = better CCU tests / scale
     writer.WriteVector3(position);
     writer.WriteUInt32(Compression.CompressQuaternion(rotation));
     writer.WriteVector3(scale);
 }
Пример #2
0
 // serialization is needed by OnSerialize and by manual sending from authority
 // public only for tests
 public static void SerializeIntoWriter(NetworkWriter writer, Vector3 position, Quaternion rotation, Vector3 scale, bool compressRotation)
 {
     // serialize position, rotation, scale
     // => compress rotation from 4*4=16 to 4 bytes
     // => less bandwidth = better CCU tests / scale
     writer.WriteVector3(position);
     if (compressRotation)
     {
         // smalles three compression for 3D
         writer.WriteUInt32(Compression.CompressQuaternion(rotation));
     }
     else
     {
         // uncompressed for 2D
         writer.WriteQuaternion(rotation);
     }
     writer.WriteVector3(scale);
 }