ULTIMATE Camera System in Unity! (Move, Rotate, Zoom, Edge Scrolling, 3D and 2D)

preview_player
Показать описание


🔴 RELATED VIDEOS 🔴

💬 Here's a pretty big video but it's the only one you need for a COMPLETE Camera System
Let's learn how to make a Camera we can Move around (with input and also with Edge Scrolling and Pan Drag), Rotate, Zoom (3 methods) and in 3D and 2D.
With this you have a perfect Camera System for any game where you want the Player to control the camera, works for Strategy games, Tycoons, Management, Top Down Action, etc.

00:00 Intro COMPLETE Camera System
01:40 CinemachineVirtualCamera Basic Setup
04:00 CameraSystem Script, Movement
07:27 Camera Smoothing, Damping
08:24 Camera Rotation
10:55 Edge Scrolling
13:55 Click Drag to Pan Camera
17:28 Code Refactoring
20:00 Camera Zoom
21:22 How to modify Cinemachine through Code
24:05 Camera Zoom, Field of View method
27:40 Camera Zoom, Move Forward method
34:16 Camera Zoom, Move Down Y method
36:14 COMPLETE Camera System
36:45 2D COMPLETE Camera System

📝 Some Links are Affiliate links which means it costs the same to you and I get a nice commission.
🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unitytutorial #unity3d #gamedev

--------------------------------------------------------------------
Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.

I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.

--------------------------------------------------------------------
- Other great Unity channels:
--------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

💬 Here's a pretty big video but it's the only one you need for a COMPLETE Camera System
Let's learn how to make a Camera we can Move around (with input and also with Edge Scrolling and Pan Drag), Rotate, Zoom (3 methods) and in 3D and 2D.
With this you have a perfect Camera System for any game where you want the Player to control the camera, works for Strategy games, Tycoons, Management, Top Down Action, etc.

00:00 Intro COMPLETE Camera System
01:40 CinemachineVirtualCamera Basic Setup
04:00 CameraSystem Script, Movement
07:27 Camera Smoothing, Damping
08:24 Camera Rotation
10:55 Edge Scrolling
13:55 Click Drag to Pan Camera
17:28 Code Refactoring
20:00 Camera Zoom
21:22 How to modify Cinemachine through Code
24:05 Camera Zoom, Field of View method
27:40 Camera Zoom, Move Forward method
34:16 Camera Zoom, Move Down Y method
36:14 COMPLETE Camera System
36:45 2D COMPLETE Camera System


🔴 RELATED VIDEOS 🔴

CodeMonkeyUnity
Автор

I'm seriously impressed by both the rate and quality of content you put out.

antijulius
Автор

Awesome! You’ve been doing an amazing job with your videos lately. Especially the character swap and the backstab videos! Looking forward for more content.

abdou
Автор

Oh, this sounds like it's going to be a vrry good addition to your turn based strategy course, the camera controls were driving me crazy during testing ^^'

RancorSnp
Автор

Excellent video. Totally a definitive guide for Cinemachine and all you may need to know for a Camera control.

cpu_UP
Автор

Incredible video as always! One issue I ran into with my 2D top-down game was that when I rotated the camera, my health bars in world space would also rotate. To keep the health bars (and other world space UI elements) aligned with my camera, I added a script component to my world space canvases with this Update() function:

private void Update() {
Camera camera = Camera.main;
+ camera.transform.rotation * Vector3.forward, camera.transform.rotation * Vector3.up);
}

This makes sure that canvases that are children of my game objects would remain aligned with the camera.

There may be a better solution, but I hope this helps anyone else with world space canvas rotation issues!

cosmicrenegade
Автор

thank you so much for making more videos lately
your channel is an archive of experience and knowledge, aspiring programmers could look into

thanks for updating and making great video tutorials

alirzana
Автор

Some tips:
1. If you tap both W and A, S and D, etc., you get a speed boost to the camera which can be a bit strange. Use this code to fix that:

float inputMagnitude = inputDir.magnitude;

if (inputMagnitude > 1f)
{
inputDir /= inputMagnitude;
}

inputDir.z *= (1f + inputMagnitude);
inputDir.x *= (1f + inputMagnitude);

Basically, it divides z and x by a certain amount to cancel the extra-speed effects.

2. You can change those 4 (or 8 if you use two line if statements, or even 16 if you also add braces) GetKey movement lines to something much more compact like this:

inputDir.z = Input.GetAxis("Vertical");
inputDir.x = Input.GetAxis("Horizontal");

Also, it is better to use an GetAxis approach if using the old input system anyway.

accioollie
Автор

Great, now I just need to look into fading objects obstructed by the camera. Thank you!

bezimienny
Автор

This is a wicked awesome tutorial! I was able to modify this to work with my orthographic lens flawlessly following your tips and guide! TY!

Axthemax
Автор

You are doing wonderful work. It tremendously helps and fastens my work. Keep it up. It seems like you know everything about Unity.

alicivrilify
Автор

Nice! I remember learning Cinemachine from your old video and this looks very useful too!

lastkings_games
Автор

Thank you so much for this detailed tutorial. For sake of time, I just skipped to the rotation part to solve my problem. It worked like a charm. I'm definitely saving this video in a playlist to reference later. I'm sure there's tons I can use because I suck with everything that has to do with the transform component lol

Luvseatshawty
Автор

My favorite way is to do linear regression for the minimum and maximum points of camera position and rotation, then you will get straight lines that go from the minimum point to the maximum of the camera, then you use the mouse scroll to decrease or increase a float which will define the x and then you calculate the Y midpoints of the camera and define the current position for it, this method gives a more dynamic effect, at the same time that the camera lowers or raises it rotates together, it is wonderful!

gustavomartins
Автор

thanks for the amazing tutorial! so nicely explained and all bases covered :]

clarathulin
Автор

And another great video from Code Monkey, still as efficient as ever. Thanks !

jean-michel.houbre
Автор

Great video as usual! You content is always so well done and informative. When using Cinemachine i always like to use the framing transposer to handle zoom, because of the camera distance property it has.

vazzius
Автор

Wow he's really good at what he does. I really appreciate him sharing his coding knowledge. Thank you Code Monkey!

stephans
Автор

Awesome video, thank you. First time picking up Unity and learning to create a game and I managed to follow this (just). ran in to a couple of issues and managed to resolve them too.

pebkaclive
Автор

The script and the scene both are looks awfully good

StellarMirage