Camera and Controls Switcher glitch??

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;
}
}

It could be me, but I have some trouble understanding your Setup in the Scene. Thats what I understood, there is:

  • a Player-GameObject with the ‘FirstPersonController’
  • a Player-Camera
  • a Ship-GameObject with the ‘SpaceshipControlls’
  • a Ship-Camera
  • a Switch-Script, which is the one you posted above

Now you got the problem that the ‘FirstPersonControll’ makes the Ship-Camera rotate instead of the Player-Camera, after switching to the Player-GameObject?

If I got that right your ‘FirstPersonControll’ Script maybe only rotates the main camera of the current scene, which might be your Ship-Camera, meaning that you should try swaping the two cameras.

You should post your two other scripts aswell, if that doesnt fix it.