Hello,
I’m just starting out with Unity and I have a issue I can’t solve. I’ve searched a lot through Google for an answer but I couldn’t find it.
In the game you can walk around a (small) world as a cube. When the cube hits a certain point in the world there is a camera change. So first you walk with the cube and you see the back side of it, the when you hit a certain point there is a camera change so you see the left side of the cube. All this is going well, but there is one problem. When the camera is changed, the controls are flipped. Left is now up, right down etc. Obviously this isn’t supposed to happen. How can i change the camera and still get the right controls?
This is my move script:
void FixedUpdate () {
input = new Vector3(Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
if(rigidbody.velocity.magnitude < maxSpeed){
rigidbody.AddRelativeForce(input * moveSpeed);
}
}
And for the camera switching I enable and disable the camera’s with this script:
public class CameraSwitch : MonoBehaviour {
public Camera[] cameras;
// Use this for initialization
void Start () {
cameras[0].enabled = true;
cameras[1].enabled = false;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Return)) {
cameras[0].enabled = !cameras[0].enabled;
cameras[1].enabled = !cameras[1].enabled;
}
}
}