This is my first post here and I'm not too experienced with Unity, so keep that in mind. I am working on a project (a virtual streaming app specifically) where I have four cameras that the user can switch between with number keys.
The program has a room with a table in it, and a character is located in front of that table. The character is controlled using outside software and the VMC protocol.
The four different cameras are located in the front of the room, pointing toward the character's head, on a table, and a first person camera with a fixed position, but whose rotation corresponds to that of one of the character's bones.
I wrote a simple C# script that allows the user to switch between the four:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamSwitch : MonoBehaviour
{
public GameObject cam1, cam2, cam3, cam4;
public GameObject headBone;
public int camera = 1;
void Start()
{
cam1.SetActive(true);
cam2.SetActive(false);
cam3.SetActive(false);
cam4.SetActive(false);
}
void Update()
{
if (Input.GetButtonDown("Key1"))
{
camera = 1;
cam1.SetActive(true);
cam2.SetActive(false);
cam3.SetActive(false);
cam4.SetActive(false);
}
if (Input.GetButtonDown("Key2"))
{
camera = 2;
cam2.SetActive(true);
cam1.SetActive(false);
cam3.SetActive(false);
cam4.SetActive(false);
}
if (Input.GetButtonDown("Key3"))
{
camera = 3;
cam3.SetActive(true);
cam1.SetActive(false);
cam2.SetActive(false);
cam4.SetActive(false);
}
if (Input.GetButtonDown("Key4")) {
camera = 4;
cam4.SetActive(true);
cam1.SetActive(false);
cam2.SetActive(false);
cam3.SetActive(false);
}
if (camera == 4)
{
cam4.transform.rotation = headBone.transform.rotation;
}
}
}
What I want is to make a picture-in-picture display something like this when the 1st-person view is turned on:
I've tried adding a second smaller camera, but to no avail. Also for what it matters, I found this script doesn't work unless all of the cameras are turned on before the project is run.
Thanks in advance.