How can i make it so that when i press c the camera will go into first person view?,How can i change my view to first person view when i click c?

I have made it so that the the camera follows the player and the default camera view is a bit behind the person but i would like to have it so when i press c it will switch where the camera is. It already follows the player and i just need it to switch views when i press c. Please help.,I want to be able to press c and the camera will go into first person view on the player. I have already scripted it so that it follows my player but i need it so that it goes into a certain view when i click c.


A bit of scripts to show always helps to get the right help needed

Q1. are you trying to switch between 2 cameras?
Q 2. are you trying to use one camera to switch perspective from top down/above player to first person where the players head is ?

if Q1 u will need to reference the cameras in your scene and set active cam to the camera on players head for the first person view

if Q2 u will need to access the Vector-3 transform position of the (camera.main) to switch the transform from top down location to first person location

show some scripts to get more detailed feedback
hope it helps goodluck

To make life easier use 2 cameras there are also additional benefits to doing it this way you wont have to mess with the transforms of cameras like all things you can do it the easy way or the hard way.

i choose an effective way to do it
so CREATE 2 CAMERAS if u already have your top down camera all you need is a extra camera for first person.


1 parent your cameras to your player object you can see the cameras view in the inspector so make sure both cameras views are set the way you want them to be during run-time/play-mode.

so you should have first person cam looking out from head position of player and top-down cam should be above players head and back a bit also with rotation x set to something like 40 in the transform component.

2 after your cameras are set up in the desired location with the right views
ie / cam 1 view top down / cam 2 view first person/ and they are parented to your player object
drag the switch cam script onto your player object.

3 in your player object in the inspector you will see 2 slots for camera named appropriately on the switchcam component . drag your topdown cam into the topdowncam slot and drag your
first person cam into the first person cam slot.

i wrote the script to work to work with C key press as requested

using UnityEngine;
using System.Collections;

public class switchcam : MonoBehaviour {
//reff cam for topdown
public Camera topdowncam;
//reff cam for firstperson
public Camera firstperson;
//switch trigger for cameras stored as a bool
public bool switchcamera;

// Use this for initialization
void Start () {
// why am i here if am not being used? delete me for optimisations sake (void start not being used) 
// Update is called once per frame
void Update () {
// switch cameras on GetkeyUp			
	switchcamera = false;
	topdowncam.enabled = false;
	firstperson.enabled = true;
	switchcamera = true;
	topdowncam.enabled = true;
	firstperson.enabled = false;


Here is my script so far, i just need to change where the cameras view is when i press c.Oh yeah and i am using C# @ppg

Hi. I need to know this as well. :slight_smile: