Hi, I have a camera switcher script that works pretty well except for one thing, It switches fine and all of the controls work decent but, the Vertical axes in the Input manager is mapped to mouse control for both controllers. I have each script enabling and disabling when you switch players but, for some reason you cannot look up and down with the Earth controls and when you do look up and down It moves the camera up on the ship and it doesn’t just pitch up it moves the entire camera upwards. I have tried disabling the player controls alongside of the spaceship controls but, since the script is applied to the ship, it does not register the First Person Controller on the other character. If anyone can help me fix this glitch I will be very grateful! Please let me know if you have a solution!
Script:
var cameraPlayer1 : GameObject;
var cameraPlayer2 : GameObject;
var exitPoint : GameObject;
var player : GameObject;
var canExit : boolean;
var moveSpace : SpaceshipControls;
function Start(){
moveSpace = this.GetComponent(SpaceshipControls);
}
function Update()
{
if(Input.GetKeyDown("1"))
{
GetComponent(SpaceshipControls).enabled = true;
cameraPlayer1.active = true;
cameraPlayer2.active = false;
player.active = false;
moveSpace.enabled = true;
}
if(Input.GetKeyDown("2") && canExit == true)
{
GetComponent(SpaceshipControls).enabled = false;
cameraPlayer1.active = false;
cameraPlayer2.active = true;
player.transform.position.x = exitPoint.transform.position.x;
player.transform.position.y = exitPoint.transform.position.y;
player.transform.position.z = exitPoint.transform.position.z;
player.active = true;
moveSpace.enabled = false;
}
}
function OnTriggerStay(Col : Collider){
if(Col.tag == "Planet"){
canExit = false;
}else{
canExit = true;
}
}