The player has animation rigging of head turning up and down, how to synchronize this in Photon2?
I’m trying to synchronize the tilt of my head like this:
public Transform head;
void LateUpdate()
{
if (PV.IsMine)
{
head.transform.localEulerAngles = objRot;
}
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(objRot);
}
else
{
this.objRot = (Vector3)stream.ReceiveNext();
}
}
But nothing comes out
solution to my problem
public Transform AimTarget; // target rigging animation
public Transform head;
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(head.transform.position);
stream.SendNext(head.transform.rotation);
stream.SendNext(AimTarget.transform.position);
stream.SendNext(AimTarget.transform.rotation);
}
else
{
head.transform.position = (Vector3)stream.ReceiveNext();
head.transform.rotation = (Quaternion)stream.ReceiveNext();
AimTarget.transform.position = (Vector3)stream.ReceiveNext();
AimTarget.transform.rotation = (Quaternion)stream.ReceiveNext();
}
}