Unity 5 - Switching Cameras from a Third Person Camera

preview_player
Показать описание
A simple and easy tutorial on how to make a dayz/warz like camera view switch, from first person to third person and an extra behind view in Unity.

All scripts & assets:

Music Used:
Cayman Cline - Memos (Prod. BNJMN)
Рекомендации по теме
Комментарии
Автор

Thanks for this! Even 4 years on this video is still helping people :)

Undeadk
Автор

I’m so happy now. I’ve spent the last week trying to get this to work but I couldn’t. Apparently you need to drag the camera into the script to link it together. Btw thx.

clex
Автор

the SwitchVeiw script wasnt in the download folder

rockincartoons
Автор

I actually thought this wasn't going to work but it did...I only had Two cameras and I'm surprised I actually aced it first time considering my knowledge.

Here's the script in case you got something wrong, it works:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraSwitcher : MonoBehaviour
{
[SerializeField]
Camera camera1;
[SerializeField]
Camera camera2;

//Camera1&2 are my cameras' that switch from third person to side view as i'm //making a 3d version of that jumping block thing.

private bool switchCam = false;
private bool backCam = false;

void Start()
{

= true;
= false;


}


void Update()
{

if (Input.GetKeyUp("c"))
{
switchCam = !switchCam;
backCam = false;
}
if (Input.GetKeyUp("v"))
{
switchCam = false;
backCam = true;
}
if (switchCam == true)
{
= true;
= false;
}
else if (backCam == true)
{
= false;
= true;
}
else
{
= true;
= false;
}
}
}

bigjiggly
Автор

Guys. I had a conflic problem when adding the script to a FPSController Asset. I am now able to use both scipt at the same to by adding a [SerializeField] in front of private Camera m_Camera;
This way, you can link the camera you want to the FirstPersonController script you want. It worked for me.

jonathankeller
Автор

thanks man, exactly what I was looking for !

ibhoopin
Автор

Hey! Nice tutorial. It woked great for me, but I would like to know way to have my crosshair switch with the camera. Or is it something like have a crosshair that's invisible for each camera and have it visible only when I'm using its respective camera?

blackZall
Автор

Thanks mate, your explanations are very clear :)
Cheers

jonathanpascal
Автор

Flashes back and forth between both cameras help?

EVILxJUGGERNOG
Автор

what is your camera that can use mouse to control point of view

redinternet
Автор

+Lurony Are your DetectHit and DetectHitPlayer scripts not for public knowledge? I don't see them on your GitHub

chadm
Автор

hi, I'm having trouble with my third person controller. I'm kinda new in unity. can you help me with my controller? I want to do one like what u have in the video. where u can turn using your mouse. and move using WASD keys. please help me.

bryanmendoza
Автор

How did you get that bobing head motion! its freaking awesome!! :D

dorinbuzilov
Автор

Have you removed the code from your GitHub?, the link seems to not work and looking at all your codes, I can't find a code for switching cameras and I really need help with it.

minecraftcreations
Автор

I don't see any scripts named SwitchView nor anything to do with cameras in your assets, is it no longer available?

seanpalumbo
Автор

hey i did that today 4 hours ago the same thing well at least i know it works :D

CarlosGomes-swbt
Автор

Hey! What is that asset of the character and ambience like castle? Did you make it?

jackunlocker
Автор

Couldn't find you script in your list but thanks anyway

AndiBLEH
Автор

hey
I was wondering if you could give me the source of this tutorial cause I couldn't find it in your github
thanks

technokhafan
Автор

this script is not include in your github repository

mauricioyaman