So whenever I use this script on my multyplayer game it seams when someone moves it moves the other players too. Any ideas how to fix? I tried it useing the "player" var and without it. Player is themself. Code (csharp): var projectile: Transform; var gun : Transform; var player : Transform; function Start () { } function Update () { if (Input.GetKey(KeyCode.W)){ player.Translate(Vector3.forward * Time.deltaTime * 2); } if (Input.GetKey (KeyCode.A)){ player.Translate(Vector3.left * Time.deltaTime * 2); } if (Input.GetKey (KeyCode.S)){ player.Translate(Vector3.back * Time.deltaTime * 2); } if (Input.GetKey (KeyCode.D)){ player.Translate(Vector3.right* Time.deltaTime * 2); } } }
Is that attached to all Player objects? If so, each one is polling for key presses and applying movement. You need this to be attached to *only* the GameObject you want to have listening for movement on the local machine.
ohh thanks. I got it working and it works realy smoothly now, but you control the other person instead of yourself, any ideas? I want you just to be abel to control your own character, not the other if you get what I mean.(Im useing 2 different computers for testing)