- Home /
[Closed]multiplayer camera script
I need a script for multiplayer! I am using this code to move: var speed = 5; var gravity = 5; private var cc:CharacterController;
function Start(){ cc = GetComponent(CharacterController); }
function Update(){ if(networkView.isMine){ cc.Move(Vector3(Input.GetAxis("Horizontal") speed Time.deltaTime, Input.GetAxis("Vertical") speed Time.deltaTime)); } else{ enable = false; }
} more when I move, it moves the wrong camera. I am using this code at the camera:
function OnNetworkInstantiate(info : NetworkMessageInfo){ if(networkView.IsMine){ //if I am the owner of this prefab Camera.main.GetComponent(SmoothFollow).target = transform; } }
Answer by adriel0000 · Nov 24, 2014 at 07:41 AM
If you attach this to the camera, the camera that is not yours be destroyed:
if (!networkView.isMine){
Destroy (gameObject);
}
Your answer
Follow this Question
Related Questions
Bullet Effect (RaycastAll Question) 1 Answer
unity3d invoke 0 Answers
Photon enable/ disable object 2 Answers
Remove first element of array 1 Answer