- Home /
Question by
thumbtackjake · Apr 13, 2012 at 02:31 AM ·
cameraswitchthird-personfirst person
3rd Person to First Person Camera
So I have a script that will switch between cameras, but I'm not sure how to get camera #1 (first person camera) attached to the '3rd Person Controller'. Even if I managed to get it to work, the control scheme would still be set for third person controls. So I guess what I'm looking for is a script that allows me to move from third person camera and controls, to first person camera and controls. EDIT: If I select camera 2 in the script as the camera from First Person Controller, I can switch over to that, but the third person controller object stays there, and obviously doesn't move with me in first person.
What I have currently is:
using UnityEngine;
using System.Collections;
public class SwitchCamera : MonoBehaviour {
public Camera camera1;
public Camera camera2;
// Use this for initialization
void Start () {
camera1.enabled = true;
camera2.enabled = false;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown("2"))
{
camera1.enabled = false;
camera2.enabled = true;
}
if (Input.GetKeyDown("1"))
{
camera1.enabled = true;
camera2.enabled = false;
}
}
}
Comment