- Home /
Question by
aronatvw · May 11, 2015 at 04:49 AM ·
rigidbodynetworkingphotonlag
Photon - Nothing Working!! Please Help (w/ Video)
I think my video here explains everything! Here is the script I have been using after trying various things! I am wondering if my problem is the fact I am using rigidbodies?
My Script
using UnityEngine;
using System.Collections;
public class NetworkCharacter : Photon.MonoBehaviour {
public Vector3 realPos = Vector3.zero;
public Quaternion realRot;
//Second attempt
// Use this for initialization
void Start () {
}
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
stream.SendNext (this.GetComponent<Rigidbody>().position);
//stream.SendNext (transform.rotation);
}
else
{
realPos = (Vector3)stream.ReceiveNext();
//realRot = (Quaternion)stream.ReceiveNext();
}
}
// Update is called once per frame
void Update () {
if (photonView.isMine)
{
}
else
{
transform.position = Vector3.Lerp(transform.position, realPos, Time.deltaTime * 10);
//transform.rotation = Quaternion.Lerp(transform.rotation, realRot, Time.deltaTime * 5);
}
}
}
Comment