Hi, i'm new to unity, i'm playing with racing game tutorial, and trying to add multiplayer capabilities to it, i followed M2H network tutorial, and seem to understand it (to some extent), I'm creating car objects by Network.Instantiate also i modified Car.js, so that car would be controllable only by object owner
function GetInput()
{
if (networkView.isMine) {
throttle = Input.GetAxis("Vertical");
steer = Input.GetAxis("Horizontal");
CheckHandbrake();
}
}
and this part seems to work. The problem that each car has a camera object assigned and camera has component CarCamera which needs target and is responsible for changing angles depenging on the car position, and when i create second car and second camera first camera loses it's focus and second one doesn't get one, so as a result while cars are individually controlled game cannot be played, because of that camera issue.
The script i use for instaniating players is:
function SpawnPlayer(){
var player : Transform = Network.Instantiate(networkCarPrefab, Vector3(860, 102.2085, 878), transform.rotation, 0);
var camera : Transform = Network.Instantiate(Main_Camera, Vector3(860, 102.2085, 878), transform.rotation, 0);
var carCamera = camera.GetComponent("CarCamera");
carCamera.target = player;
}
Would anyone point me into direction i should be digging ? Thx