Hello,
I am working on a multiplayer game that is being created within a network. So far, everything is working fairly well… Except my networkView. When I open to instances of the game (one in the editor and one in the player), it seems as though the game is wanting to duplicate the player and camera, causing one screen to control the player from the other, and vice versa.
MovementScript.js Code:
var speed:int;
var rotateSpeed:int;
var gravity:int;
private var cc:CharacterController;
function Start(){
cc = GetComponent(CharacterController);
}
function Update(){
if(networkView.isMine)
{
//INITIATE AND MAINTAIN GRAVITY
cc.Move(Vector3(0, -gravity, 0));
//MOVE FORWARD
if(Input.GetKey(KeyCode.UpArrow))
{
cc.transform.Translate(Vector3(0, 0, 1) * speed * Time.deltaTime);
}
//MOVE BACKWARD
if(Input.GetKey(KeyCode.DownArrow))
{
cc.transform.Translate(Vector3(0, 0, -1) * speed * Time.deltaTime);
}
//ROTATE RIGHT
if(Input.GetKey(KeyCode.RightArrow))
{
cc.transform.Rotate(Vector3(0, 1, 0) * rotateSpeed);
}
//ROTATE LEFT
if(Input.GetKey(KeyCode.LeftArrow))
{
cc.transform.Rotate(Vector3(0, -1, 0) * rotateSpeed);
}
}else{
enabled = false;
}
}
Does anyone know where I might be going wrong?..