Hi there!
In my multiplayer game I want to synchronize a Character's rotation(with state synchronization), but only one axis.
I would like the receiver just to receive the rotation of the one specific axis (looking left/ right), whereas the sender can also look up/down.
The problem is, that I don't really know how to do so.^^ As said, I've only managed to sync the whole rotation... I'm also very confused with all the different types of rotation (Quaternion, eulerAngles, vector3(?)). .O
Here is the code I got to synchronize (in C#):
`using UnityEngine;
using System.Collections;public class Synchrnization : MonoBehaviour {
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
if (networkView.isMine)
{
if (stream.isWriting)
{
Vector3 pos = transform.position;
Quaternion rot = transform.rotation;
stream.Serialize(ref pos);
stream.Serialize(ref rot);
}
}
else
{
if (!stream.isWriting)
{
Vector3 pos = Vector3.zero;
Quaternion rot = Quaternion.identity;
stream.Serialize(ref pos);
stream.Serialize(ref rot);
transform.position = pos;
transform.rotation = rot;
}
}
}
}
`
/* I was wondering if any of you guys could help me out =). Any help would be appreciated. Thanks in advance */