move an object first on Master Client view

hi, there's a way to move an object first on the Master Client view and after that reposition it on my view?

the normal code is :

if (photonView.isMine){

// move it and after that reposition it by Serialize...

}


anyone can help me?

Comments

  • Huh?
    Scene PhotonViews can only be modified by the MasterClient. The same is true for everyone's own game objects.

    Or do you want to hand over control of one object?
  • Tobias wrote:
    Huh?
    Scene PhotonViews can only be modified by the MasterClient. The same is true for everyone's own game objects.

    Or do you want to hand over control of one object?



    no, i instantiate a player obj.. and normally i control it locally by this code..
    if (photonView.isMine){
    
          rigidbody.velocity = //bla bla bla...
    
    }
    
    and after that i re-position it on the other view with this
    using UnityEngine;
    using System.Collections;
    
    public class NetworkCharacter : Photon.MonoBehaviour
    {
        private Vector3 correctPlayerPos; // We lerp towards this
        private Quaternion correctPlayerRot; // We lerp towards this
        public OnSerializeRigidBody onSerializeRigidBodyOption = OnSerializeRigidBody.All;
      
    
        void Update()
        {
            if (!photonView.isMine )
            {
            	
            	print("yes, stiull update..");
                transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5);
                transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5);
            }
        }
    
        void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
        {
            if (stream.isWriting )
            {
               	stream.SendNext(rigidbody.angularVelocity);
                stream.SendNext(rigidbody.velocity);
    
                stream.SendNext(transform.position);
                stream.SendNext(transform.rotation);
            }
            
            else {
             	
             	rigidbody.angularVelocity = (Vector3)stream.ReceiveNext();
               	rigidbody.velocity = (Vector3)stream.ReceiveNext();
                
                this.correctPlayerPos = (Vector3)stream.ReceiveNext();
                this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
    
            }
        }
    }
    
    


    but i would like to send the rigidbody.velocity first on the master client view and move it ... and after that reposition it on my view.. it's possibile?

    can you help me Tobias?
Sign In or Register to comment.