@@Hennejoe Yes, it just appeared to me. It seems YT is starting to recommend smaller channels for us, it's happening to me and my friends all the time. I hope it continues like this!
Hi Joe! I got to know you from your amazing Prince of Persia speedruns. I wish you did more videos about that, perhaps making some tutorials or demonstrating glitches could be something to consider. Regardless, thanks for making videos, love your voice and your way of explaining things. Hope you continue :)
Hey, great video! I want to have first person + fixed camera angles like these at some places in the game (but mainly first person). Do you know how to do this?
Awesome video this is exactly what I needed! One thing I am noticing though is that these virtual cameras dont have Culling Mask build in, like if I needed a wall to be invisible when a specific camera is active, do you have any insight towards that?
Inside the virtual cameras settings under the "Lens" section there's a slider called "Near Clipping Plane" that lets you set a minimum distance away things need to be before the camera will show it. By default it's set to 0.3, but adjusting it higher will push it further in front of the camera and cause it to not display walls that block the view. Only issue you might run into unrelated to this tutorial is if you're trying to use something like cinemachine's ClearShot camera, as while the wall isn't visible in the game view it's still technically in the way and will count as blocking the camera from seeing the target, which will prevent it from ever being swapped to. But in this case where there's manual trigger boxes for camera swapping it works good
could you also do a video on how to make dynamic camera angles? like in the silent hill games where the camera is not exactly fixed but also moves with the player. Until Dawn also uses this
Really good tutorial thank u! Can u explain how to animate character? I got character with your movement code, got animations: move and idle in animator, but how to trigger it? :D My character got just idle animation and moving with it too
is there any way to have modern controls too . you mentioned in the video that with modern controls where the player faces related to the camera can make you exit a scene which just has been entered when you hold the input. whats the way to avoid this at modern codes, are you planning on making a tutorial about this too?
There is a way to avoid this with camera relative controls but I wouldn't make a tutorial for it as I still don't think it's preferable You need to store the direction you're holding every time a camera is switched and only update to the new camera orientation after that direction is let go and pressed again
This video is pretty good and I definitely appreciate you making it. However, unless I missed something, why are you tracking the transform of the player in the CameraSwitcher script?
This tutorial was super helpful, but the CamSwitcher script did not work for my 2D game. After searching for the answer, the solution was to replace OnTriggerEnter, OnTriggerExit, and Collider with OnTriggerEnter2D, OnTriggerExit2D, and Collider2D. You will need a Rigidbody 2D and Capsule Collider 2D on your player.
so there is a way to keep the trigger zone checking if the player are there? lets say i have a room with 4 doors on it so the player can go in that room from 4 differents places or scenes, everytime i load that scene the camera will always be the first one on priority instead the one the player are triggering the zone
Whatever you've set the active priority to in your script, make sure all your cameras are below that priority in the inspector before hitting play and it'll update the one the player is in on start
I am having a very odd bug, it works for the first camera switch, but then after the second switch of the camera 2 of the zones turn to 1 and no other trigger zone works after that, also when it switches once if i go back to the starting trigger zone it does not switch back. The camera goes from 10 to 0 and doesnt go back to 1 once you leave and try to go back inether. any idea on why this is?
I don't know why that would be! Do you have a screenshot of your code? In the video you can see it should work for multiple switches of the camera no matter if you go back and forth
@@Hennejoe here is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; using Cinemachine; public class CamBehavor : MonoBehaviour { public Transform Player; public CinemachineVirtualCamera activeCam;
private void OnTriggerExit(Collider other) { if(other.CompareTag("Player")) { activeCam.Priority = 0; } } } i have insured that the Player has been set up properly and the triggers are linked to the right camera.
do you have any advice on how to make it so that the camera follows thwe player in larger scenes/environments like in FF7 origanal. So far, I have only seen cameras that remain in a fixed position and am trying to make it so that the camera follows the players in scenes like long hallways or city parks. does anyone have an advice on that?
Theres a cinemachine component that will let you dolly along a track, I don't remember the exact name but it's got dolly in the name! Probably best to look up another tutorial for it though, won't be able to explain it through text I think
I used your tutorial, and everything works as it should, except that when the player moves from camera to camera, it’s a long transition instead of being instantaneous. Any ideas about why?
I ended up solving my problem. If you already have a main camera, cinemachine adds a brain component to that one. You have to change the update style to cut.
Huh. Whenever mine starts the camera immediately changes to the 2nd camera despite the player not being there. After the player moves into the trigger for the second one and back it then swaps back to the first one and you swap normally. Anyway to stay on the first camera? Codes here. using System.Collections; using System.Collections.Generic; using UnityEngine; using Cinemachine; public class CamSwitcher : MonoBehaviour { public Transform Player; public CinemachineVirtualCamera activeCam; private void OnTriggerEnter(Collider other) { if(other.CompareTag("Player")) { activeCam.Priority = 1; } } private void OnTriggerExit(Collider other) { if(other.CompareTag("Player")) { activeCam.Priority = 0; } } }
@@Toffifex sounds like the script isn't working for those cameras! Are you able to paste what you have exactly? Also make sure that the script is applied correctly and all the variables have been assigned
wow that demo looks crisp and beautiful. i'm in love
Edit: i found your video by searching: *unity fixed camera*
it was the #1 result
Ayy! Glad the keywords helped someone :D
@@Hennejoe Yes, it just appeared to me. It seems YT is starting to recommend smaller channels for us, it's happening to me and my friends all the time. I hope it continues like this!
Awesome tutorial Joe!! Love to see more tutorials like this
Yessssss, been a while since you uploaded, been waiting for this, one of my favourite speedrunners, keep on uploading and grinding.
Thank you so much for uploading this😢 have been looking for this tutorial for hours
thanks so much! its way simplier than i thought. Its good that you showed how it looks like in a demo too!
I am looking for this to use in my project, and i did exactly what you say in this video, has been so useful, thanks very much!!
The greatest tutorial Ive seen. So helpful. Thank you Million 😋😋
HOLY COW this is so simple and yet so effective!! Thanks!!!
exactly what i was looking for! thanks
Hi Joe!
I got to know you from your amazing Prince of Persia speedruns. I wish you did more videos about that, perhaps making some tutorials or demonstrating glitches could be something to consider. Regardless, thanks for making videos, love your voice and your way of explaining things. Hope you continue :)
Definitely would love to make pop content but haven't had much time for videos recently with that
@@Hennejoe Understandable, then best of luck to you with whatever is keeping you busy in life :))
Excellent tutorial! Thanks a lot
HI ! I'm a beginner on unity and its very useful !! Thank you !!
I appreciate the help man. 👍👍👍👍👍
Great stuff. Subbed. Would love to see more…
well done mate
Bro, amazing
Doing god's work
helped a lot
How to create a pre-render background like RE??
Hey, great video! I want to have first person + fixed camera angles like these at some places in the game (but mainly first person). Do you know how to do this?
Awesome video this is exactly what I needed! One thing I am noticing though is that these virtual cameras dont have Culling Mask build in, like if I needed a wall to be invisible when a specific camera is active, do you have any insight towards that?
Inside the virtual cameras settings under the "Lens" section there's a slider called "Near Clipping Plane" that lets you set a minimum distance away things need to be before the camera will show it. By default it's set to 0.3, but adjusting it higher will push it further in front of the camera and cause it to not display walls that block the view.
Only issue you might run into unrelated to this tutorial is if you're trying to use something like cinemachine's ClearShot camera, as while the wall isn't visible in the game view it's still technically in the way and will count as blocking the camera from seeing the target, which will prevent it from ever being swapped to. But in this case where there's manual trigger boxes for camera swapping it works good
could you also do a video on how to make dynamic camera angles? like in the silent hill games where the camera is not exactly fixed but also moves with the player. Until Dawn also uses this
Really good tutorial thank u! Can u explain how to animate character? I got character with your movement code, got animations: move and idle in animator, but how to trigger it? :D My character got just idle animation and moving with it too
is there any way to have modern controls too . you mentioned in the video that with modern controls where the player faces related to the camera can make you exit a scene which just has been entered when you hold the input. whats the way to avoid this at modern codes, are you planning on making a tutorial about this too?
There is a way to avoid this with camera relative controls but I wouldn't make a tutorial for it as I still don't think it's preferable
You need to store the direction you're holding every time a camera is switched and only update to the new camera orientation after that direction is let go and pressed again
You should do a mgs1 camera tutorial
This video is pretty good and I definitely appreciate you making it. However, unless I missed something, why are you tracking the transform of the player in the CameraSwitcher script?
Just a leftover from when I was doing the script another way but I forgot to rerecord the clip for that bit!
I have the exact same code, but I'm using more than two cameras. Anyways, the cams don't switch, I don't know why :(
My cameras are blending between them. How to fix it?
Help! I cannot drag the player into the TriggerZone material box!
This tutorial was super helpful, but the CamSwitcher script did not work for my 2D game. After searching for the answer, the solution was to replace OnTriggerEnter, OnTriggerExit, and Collider with OnTriggerEnter2D, OnTriggerExit2D, and Collider2D. You will need a Rigidbody 2D and Capsule Collider 2D on your player.
My camera switches to the 2 one when i start
I have an idea for a horror game but I don’t know anything about the software
thx for tutorial dude!
Can camera transitions be delayed like in resident evil? millisecond delay time would be nicer.
Yup!
You can define the camera transition in the Cinemachine Blend options in the Cinemachine Brain Component
@@Hennejoe Thx my friend.
so there is a way to keep the trigger zone checking if the player are there? lets say i have a room with 4 doors on it so the player can go in that room from 4 differents places or scenes, everytime i load that scene the camera will always be the first one on priority instead the one the player are triggering the zone
Whatever you've set the active priority to in your script, make sure all your cameras are below that priority in the inspector before hitting play and it'll update the one the player is in on start
@@Hennejoe thanks bro, i have one more question, do you how to transport player into a scene to another on a especific location in the map?
does anyone know how to make the transition between the cameras instant, instead of a swaying transition?
In the cinemachine brain, change the transition to cut instead of the default blend
I am having a very odd bug, it works for the first camera switch, but then after the second switch of the camera 2 of the zones turn to 1 and no other trigger zone works after that, also when it switches once if i go back to the starting trigger zone it does not switch back. The camera goes from 10 to 0 and doesnt go back to 1 once you leave and try to go back inether. any idea on why this is?
I don't know why that would be!
Do you have a screenshot of your code?
In the video you can see it should work for multiple switches of the camera no matter if you go back and forth
@@Hennejoe here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class CamBehavor : MonoBehaviour
{
public Transform Player;
public CinemachineVirtualCamera activeCam;
private void OnTriggerEneter(Collider other) {
if(other.CompareTag("Player"))
{
activeCam.Priority = 1;
}
}
private void OnTriggerExit(Collider other) {
if(other.CompareTag("Player"))
{
activeCam.Priority = 0;
}
}
}
i have insured that the Player has been set up properly and the triggers are linked to the right camera.
i found the issue, i had a typo
@@deadend85 only just seen this but yes, eneter -> enter should be all you need!
do you have any advice on how to make it so that the camera follows thwe player in larger scenes/environments like in FF7 origanal. So far, I have only seen cameras that remain in a fixed position and am trying to make it so that the camera follows the players in scenes like long hallways or city parks. does anyone have an advice on that?
Theres a cinemachine component that will let you dolly along a track, I don't remember the exact name but it's got dolly in the name!
Probably best to look up another tutorial for it though, won't be able to explain it through text I think
Use "Look At" at Cinemachine Virtual camera component, and select your player gameobject, thank me later
Thanks for this tutorial! it worked for 2 cameras but not when I add multiple ones, is there a possibility to add more?
This will work with any number of cameras as long as they each have the camera switching script + trigger
I'm having the same issue
Sry. it does work. But it starts out jank. i have to touch two different triggers and then it desides to start working. it being silly
it goes through some jank priority order
Nice work! Whats is the name of this game?
OS CARACTERES ESTÃO MUITO PEQUENOS PRA SE VER
I used your tutorial, and everything works as it should, except that when the player moves from camera to camera, it’s a long transition instead of being instantaneous. Any ideas about why?
Set the default blend in cinemachine brain to cut!
@@Hennejoe thanks, I’ll give it a try!
My cameras switch but they do a little transition instead of immediately switching.
I ended up solving my problem. If you already have a main camera, cinemachine adds a brain component to that one. You have to change the update style to cut.
Lol thank you
Huh.
Whenever mine starts the camera immediately changes to the 2nd camera despite the player not being there. After the player moves into the trigger for the second one and back it then swaps back to the first one and you swap normally.
Anyway to stay on the first camera? Codes here.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class CamSwitcher : MonoBehaviour
{
public Transform Player;
public CinemachineVirtualCamera activeCam;
private void OnTriggerEnter(Collider other) {
if(other.CompareTag("Player"))
{
activeCam.Priority = 1;
}
}
private void OnTriggerExit(Collider other) {
if(other.CompareTag("Player"))
{
activeCam.Priority = 0;
}
}
}
Before you press start, make sure the camera priority you want to be first is higher than any other
@@Hennejoe Uh, how?
@@Hennejoe Nevermind, figured it out!
@@kinnie9918 Hey, probably a little late, but can you tell me how you fixed the issue because I am having it as well?
@@TheGeekCraft oh, basically you need to make sure every single camera has a priority of 0 in cinemachine's configuration
Do you think this would work in Roblox Studio?
For some reason when I play the game the first camera doesn´t stay in place but it moves towards the second one. Could you help me with this issue?
What are the priority levels for each camera
@@Hennejoe The same ones in the CamSwitcher script you wrote. 1 and then 0 I am sure I wrote the code correctly I double checked.
@@Toffifex in the inspector though, what does each one say at run time
@@Hennejoe Oh, well in that case they both say 10.
@@Toffifex sounds like the script isn't working for those cameras! Are you able to paste what you have exactly?
Also make sure that the script is applied correctly and all the variables have been assigned
Umm does anyone know why my camera plays an animation when it switches
Nevermind I found out it had something to do with the main camera
@@spiff232 what did you do to fix it?
@@tobiasnilssenopedal6660 I had a main camera and changed the transition
Why is there a public player variable in the script? You never use it