How to Make a Camera System (Like Hollow Knight's) in Unity using Cinemachine | 2D Tutorial

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

In this Unity tutorial, we'll be re-creating Hollow Knight's camera system using Unity and Cinemachine.

We're going to cover:
- how to setup a direction bias
- interpolation based on your player's vertical velocity
- camera bounds (and how to break them,)
- ledge detection (so you can, for example, have the camera pan down to hint to your players that they CAN fall down that ledge.)
- setting up different camera settings for different rooms (Ie. vertically centered, vertically locked, full position locked) and a system to easily swap between them when needed.

I spent a good deal of time analyzing Hollow Knight's camera system and it's complexities, and by the end of this video you'll know how to create them all!

Link to Download the FREE 2D Asset Pack seen in this tutorial:
---
---

Contents of This Video: ------------------------------------------

00:00 - Analyzing Hollow Knight's Camera
02:54 - Direction Bias
05:37 - Interpolation Based On Vertical Velocity
07:46 - Setting Up Proper Camera Bounds
10:39 - Camera Ledge Detection
14:10 - Setting Up Multiple Cameras and a System to Swap Between Them

Who We Are-------------------------------------

If you're new to our channel, we're Brandon & Nikki from Sasquatch B Studios. We sold our house to start our game studio, and work full time on building our business and making our game, Veil of Maia.

Wishlist our Games:

Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!

Follow us on Twitter for regular updates!

#unitytutorial #unity2d #unity3d
Рекомендации по теме
Комментарии
Автор

be sure to add #if UNITY_EDITOR before the MyScriptEditor script, and an #endif at the end of it, or this will give you errors when you try to build the game.

sasquatchbgames
Автор

Wow! As an spiring Game Designer, I never realized how nuanced the camera system is in Hollow Knight, Devs should certainly implement this system in their games. Thank you Sasquatch B Studios, for another amazing tutorial!

actuallyZiggyZagga
Автор

The breakdown of how it works in hollow knight is a life saver man thanks. Was planning on doing that at some point to fine tune my camera system!

Watzefuk
Автор

Wow, this is an excellent tutorial. I think some of it was over my head but I definitely will be tucking this away for when and if I ever need it in the future. I really love your analysis of the Hollow Knight camera as well. It gave me something to think about and challenged to me to be more analytical with games I play.

StealthyShiroeanGames
Автор

Great video. I never even thought of or noticed any of this while I was playing. If you had asked me, I would have just assumed the camera always kept the knight in the centre of the screen.
It's very interesting because, in my head, I kind of figured "I could make a game like Hollow Knight" (because I can draw cartoons and use Unity) - but this video shows that there's quite a lot of polish and subtlety in a lot of aspects of the game - there's a reason why Hollow Knight was a success while most other 2D cartoon platformers fade in to obscurity.

CogNoman
Автор

Following this tutorial is mentally exhausting.

The explanations are good, but everything on the screen goes by so quickly that you don't have any time to process the information.

Then you have to pause and come back to try to read and understand something, but as a result you soon get lost in the explanation.

In the end, with a lot of effort, you understand, but the mental cost is much higher than necessary, especially for those just starting out.

heirian
Автор

Honestly, your tutorials have saved my skin enormously! excellent explanations and actually teaches the functionalities in unity and not just a copy me code.

MrBb
Автор

This is a great and informational video man! The coding is being done so fast though that it's hard to interpret what you're actually doing if you can't understand from the explanation alone. Other than that I'd say you've definitely accomplished a Hallow Knight camera!

deadbroadcastpc
Автор

Bravo! I'm starting to delve into creating a Metroidvania and you have really done an amazing job with this topic. I honestly didn't understand 90% of what you said, but i can tell you know what you're doing so I'll just use your techniques and try my best to replicate the settings until i understand everything better. Thanks!

TheWunshot
Автор

Great stuff can't wait to bring this kind of camera work into my game

heroslegendstudios
Автор

I love tweening libraries. I personally like DOTween but LeanTwean looks like a fantastic option.

midniteoilsoftware
Автор

Absolutely incredible tutorial! Thanks so much for sharing this!

FrozenFlameInteractive
Автор

I personally don't work in unity but I enjoy watching all of your videos as they are informative. Keep up the good work!

Ravisherrr
Автор

This is the best ever camera tutorial on YT and helped a lot! Thank you.

MI-llxy
Автор

Thanks for this amazing tutorial, i've learned a lot

rubencrespo
Автор

It would be really cool to see how to implement the pan for when you push up or down in hollow knight. Also Zooming in and out! in some areas id like my camerato be more zoomed in and others zoomed out. Great video as always!

masoncrowe
Автор

Amazing camera system, thank u so much!

ronaldosenajr
Автор

This is something ive never really thought about, very interesting. I wonder if there are any camera tricks i could use in a 2d top-down game

cheesymcnuggets
Автор

Note that "Oversize Window" is available on Cinemachine +2.7.5 We installed Cinemachine from the package manager and Unity installed version 2.6 which make us a little lost for a while but just update and that'll do the trick. Excellent system as this is not a camera system is THE Camera System... THANKS A LOT!!!!

pdstudio
Автор

Hi,
I watched a few of your videos and I must say you have the greatest tutorials that I ever saw for unity.
unlike other content creators, you create practical tutorials, I really like it :)

In this specific tutorial I think that you are missing something in your script (I am not sure).
if you want that your script will be able to pan camera and switch cameras I think that you need to add to your 
swapCamera method you needs to add:
_startingTrackObjectOffset =
otherwise in case of switching cameras and using a pan camera after it, when the player will leave the pan collider 
the script will return the m_TrackedObjectOffset to the values of the first camera and not to the current one.
I also think that it will be better to use a private function inside swapCamera instead of duplicating the code
you are probably doing in your code but you missed it in this tutorial :)

coldpainhob