How to use Cinemachine Confiner (Don't let Players see the VOID!)

Поділитися
Вставка
  • Опубліковано 24 бер 2021
  • 🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
    👍 Learn to make awesome games step-by-step from start to finish.
    🎮 Get my Steam Games unitycodemonkey.com/gamebundle
    💬 Cinemachine is super useful and by just adding the CinemachineConfiner component you can limit just how far the Camera can see.
    Very easy to add and will ensure the player never sees the void behind your game.
    Character Controller in Unity 2D (Move, Dodge, Dash)
    • Character Controller i...
    Easily Control Cameras with Cinemachine in Unity
    • Easily Control Cameras...
    🌍 Get Code Monkey on Steam!
    👍 Interactive Tutorials, Complete Games and More!
    ✅ store.steampowered.com/app/12...
    If you have any questions post them in the comments and I'll do my best to answer them.
    🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
    See you next time!
    📍 Support on Patreon / unitycodemonkey
    🤖 Join the Community Discord / discord
    🎮 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
    📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
    #unitytutorial #unity3d #unity2d #unity​ #gamedev​ #indiegame​ #gamedevelopment #madewithunity​ #indiedev​
    --------------------------------------------------------------------
    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.
    You can see my games at www.endlessloopstudios.com
    --------------------------------------------------------------------
    - Other great Unity channels:
    Brackeys - / brackeys
    Dani - / @danidev
    Jabrils - / @jabrils
    BlackthornProd - / @blackthornprod
    Sykoo - / sykootv
    Jason Weimann - / @unity3dcollege
    Jonas Tyroller - / @jonastyroller
    --------------------------------------------------------------------
    - Website: unitycodemonkey.com/
    - Twitter: / unitycodemonkey
    - Steam: store.steampowered.com/develo...

КОМЕНТАРІ • 98

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  3 роки тому +14

    💬 Do you know there's a bunch of super useful Cinemachine Extensions? The Confiner will help keep your camera inside a certain area, very easy to add!
    🌐 Have you found the videos Helpful and Valuable?
    ❤️ Get my Courses unitycodemonkey.com/courses or my Steam Games 🎮 unitycodemonkey.com/gamebundle

    • @Ahmed-ic9ft
      @Ahmed-ic9ft 3 роки тому +1

      could you make a short one like this but for the offset extension where the camera moves slightly after the cursor for a more reactive feel

    • @vancejoaquin2525
      @vancejoaquin2525 2 роки тому

      Instablaster

  • @cheesestudios2827
    @cheesestudios2827 3 роки тому +21

    yay! I always was wondering how to do this!

    • @flofdev
      @flofdev 3 роки тому +2

      Now you know it!

  • @adnaan_animations8136
    @adnaan_animations8136 3 роки тому +2

    Thankz Code Monkey . Insane as Always .

  • @derbabonennt8876
    @derbabonennt8876 3 роки тому +1

    This Tips are always really incredible!
    And not just the Tips for there own, I mean i just learned that there are polygon-colliders!

  • @Markyaba
    @Markyaba 3 роки тому +2

    This is perfect, I just started working on a project where this is needed and was wondering how to do this, thank you for this :)

  • @Venineitor2000
    @Venineitor2000 3 роки тому

    So useful! Thanks!

  • @KimetMX
    @KimetMX 3 роки тому

    Love your vids!

  • @michaelbarbour9869
    @michaelbarbour9869 3 роки тому

    Thank you, was really looking for arun through on how to do this.

  • @atrocewins
    @atrocewins 3 роки тому

    Amazing. Thank you so much.

  • @ruchigupta277
    @ruchigupta277 2 роки тому

    Thanks, It helped a lot

  • @hiteshsharma6522
    @hiteshsharma6522 3 роки тому

    Thanks for the help

  • @PhuocNguyen-xq2ub
    @PhuocNguyen-xq2ub Рік тому

    I was having a problem with the void of the map and struggling with the script to solve it. Thank you very much for this savior video 😊😊

  • @vladisslavss
    @vladisslavss 2 роки тому

    You are rock!

  • @rick6309
    @rick6309 2 роки тому

    Thank a lot! ;D

  • @freezinfire
    @freezinfire 3 роки тому

    Helpful👍

  • @technicalm.t.b5251
    @technicalm.t.b5251 3 роки тому

    GOOD LEARNING BRO NICE 👍

  • @goodgamershow6505
    @goodgamershow6505 3 роки тому

    I`ve spent several hours looking for a way to restrict player from seeing the emptiness and every video was a total BS, using various scripts to calculate tileset's length and etc, I almost lost my hope and then I just found your video, where you fixed my problem in just under 6 minutes. Thank you very much, never knew Cinemachine had functions like that(They actually give pretty strange names to imporant components, just naming the component as "View Border" is much more telling than "Confiner")

  • @vladisslavss
    @vladisslavss 3 роки тому

    You is awesome!

  • @jaulloa21
    @jaulloa21 3 роки тому +6

    Great. These built in features with its settings makes it less and less necessary to write code.

  • @LorenzoBraunstein
    @LorenzoBraunstein 8 місяців тому

    Your grate!

  • @Venineitor2000
    @Venineitor2000 3 роки тому

    Muy bueno!

  • @ahmadalrawee8236
    @ahmadalrawee8236 3 роки тому +6

    Plz make a topdown survival game tutorial, ilove your vids

    • @migcreatesgames2622
      @migcreatesgames2622 3 роки тому +1

      A top down tutorial ehh. Well that's a good idea. I love top down games and become pretty good at making them in Unity3d

  • @orio69
    @orio69 3 роки тому

    Thanks

  • @flofdev
    @flofdev 3 роки тому +1

    Yes!

  • @digitaltrolling
    @digitaltrolling 3 роки тому

    Good video comrade

  • @piousthepious
    @piousthepious 3 роки тому

    Great tutorial!
    How do you feel about doing tutorials on procedural animation?

  • @weckar
    @weckar 3 роки тому +1

    I recently used this very efficiently in a 3D action game where I wanted the camera to ALWAYS stay above y=0 (no matter how low the character got). I did want a clean follow if the character was higher than that. Confiner to the rescue.

  • @vladisslavss
    @vladisslavss 3 роки тому +1

    🔥🔥🔥

  • @toxicGD12
    @toxicGD12 3 роки тому

    Nice

  • @udhayarajan_m
    @udhayarajan_m 3 роки тому

    901st like 😎 btw Good work

  • @FyresGames
    @FyresGames 3 роки тому

    I've used a different way before with tilemap, but that one is a big step better.

  • @naejimba
    @naejimba Рік тому

    First, on the virtual cam, under the confiner script that is added, I don't have the checkbox "confine screen edges" to select. Second, I have a situation where I ONLY need the camera to pan on the X axis, and only by a very tiny amount... and it's like that for every level in the game and it will be the background that moves. I can't have a confiner that is smaller than the camera, right? (I have a UI that takes up the rest of the screen space on top as a canvas layer) At any rate, I've followed through well over a dozen guides and I can't get any of it to work; it doesn't switch to the virtual camera and boundaries don't work (even when trying to make the confiner larger than the camera. It should be super easy and I follow each one step by step but I would be humiliated to admit just how long I've been trying to get this to work and I am at my wit's end.
    Is cinemachine even the right option for my project? I was hoping to use it since coding is my weak point that I'm trying to develop, but at this point I've wasted enough time, and what I need to do is simple enough that I'd almost rather try to learn to do this using code. Thoughts?

  • @mrLuleGameDev
    @mrLuleGameDev 3 роки тому

    I really like your work. Is it possible for you to make a video about camera controller like the games inside or until down has?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      Haven't played them but with Cinemachine you can do all kinds of things very easily. One super useful thing is how you can set up your Virtual Cameras in any way you want them and then swap between them by playing with the priority.

  • @rohinth9580
    @rohinth9580 3 роки тому

    Can you create a video about bloodhound's abilities in apex legends? lik you created the cyberpunk's mechanics!!!!

  • @tbage2210
    @tbage2210 3 роки тому

    I took the course but my camera, just goes straight over the boundary. The actual area the player can see still confines, but you have to hold the controls down to come back. Aka, the main camera is moving beyond the boundaries, the virtual is not

  • @beelan515
    @beelan515 3 роки тому +2

    What if you had multiple rooms and you wanted the camera to switch between them when the player transitioned from one to the other?

    • @supertenchoo4271
      @supertenchoo4271 Рік тому

      cinemachine extension called cinemachine collider can do that

  • @virtualmaestro6893
    @virtualmaestro6893 3 роки тому

    Thank you for the video!
    General question about Cinemachine. If we need to control a camera inside a game (so it is not static) when you would NOT recommend using Cinemachine (e.g. maybe in the mobile projects because of calculation intense)?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      The only reason not to use it is if you have a very specific use case where you need some very specific exact control over the camera.
      But Cinemachine has tons of features so in 90% of cases it will be the best option compared to writing your own from scratch.

  • @rathodketan5551
    @rathodketan5551 3 роки тому

    can you please made this types of sort basics tutorial s

  • @alligator4397
    @alligator4397 2 роки тому +1

    I have a question: This function works when im using the perspective projection in the main camera?? in the video you used the orthografic projection. btw your tutorial always help me with my projects

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Hmm I didnt test it but I think it should work, although it might just work to block the camera position itself and not what the field of view sees, might need to do some math for that.

  • @jacobester3846
    @jacobester3846 3 роки тому

    Thank you, very useful. Do you also use 2d collider for a top-down/isometric camera in 3d game ?

  • @brockormond4131
    @brockormond4131 3 роки тому

    Quick question: Couldn't you have used the Box Collider that you were using to restrict the character movement as the reference for the Camera Collider also? Rather than making a separate box for each?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      If you had a collider on top of the walking area yes, but what I have in the demo are 4 separate solid walls that the player cannot go through.
      That would work but that design would require a different character controller that instead of hitting walls it would test if its inside a valid walking collider.

  • @jvhdk
    @jvhdk 3 роки тому

    please create an ecosystem tutorial!

  • @divyeshvora3939
    @divyeshvora3939 3 роки тому

    Please make series top down shooter game from scratch

  • @kingofroms7224
    @kingofroms7224 3 роки тому

    But when you change the level and there is different polygon collider in every scene how can you maintain that because it each times it losses it refrence

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      You can modify the field through code after you load the level

  • @Ahmed-ic9ft
    @Ahmed-ic9ft 3 роки тому

    I need this but i have rooms and the player teleports to new once reached the gate. Wont the camera get stuck?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      If you teleport then you would also change the Collider when teleporting to the new one

  • @falk5055
    @falk5055 3 роки тому

    Me: Thinks about this proplem for my next game
    UA-cam Recromendation: Shows this Video
    Me: Can you read my mind?

  • @surgetale
    @surgetale 3 роки тому

    I am working on a 2D Platformer where the level is put together by multiple parts in a random order. How would you limit the cinemachine camera when you don't know exactly what the level will look like? I want this to be done by a single camera without any transitions between cameras. Is there a way to do this?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      Not sure what you mean by multiple parts but if you're creating the level dynamically then you can also create the collider points dynamically

    • @surgetale
      @surgetale 3 роки тому

      @@CodeMonkeyUnity Thank you. I will give this a try

  • @elinal9985
    @elinal9985 3 роки тому +1

    Does it work with a 2D Box Collider, instead of a polygon collider?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      Yes it works with any type of Collider

    • @elinal9985
      @elinal9985 3 роки тому

      @@CodeMonkeyUnity Thanks for the reply!

  • @adkinsy85
    @adkinsy85 3 роки тому

    Can you make a video on how to protect your game's by being stolen or copied by others.like in your own way.❤️

  • @ahmetfirat23
    @ahmetfirat23 3 роки тому

    If you try to use L shaped polygon collider as confiner, camera acts weird. Dunno how to solve.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      How weird? Does it have enough space to fit the camera? If you make it super small or zoom out a huge amount it won't be able to fit the camera in the area

  • @dumbling02
    @dumbling02 Рік тому

    unfortunately, enabling 'ignore raycast' does not solve my problem and the collider keeps messing with the physics of my game. i don't know what to do, and i don't understand the physics settings, either. :( can anyone help me?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      You can also put it in a separate layer, then go onto Edit - Project Settings and in the Physics Collision Matrix make sure that layer doesn't interact with anything else.

  • @shantanupandey5174
    @shantanupandey5174 3 роки тому

    Why don't make boundaries and spread it to the exposed camera area?

  • @TshwinhoR
    @TshwinhoR 3 роки тому

    What is void?

  • @soulofkiran9764
    @soulofkiran9764 3 роки тому

    Hello Code Monkey ! Could you please make a video about making Textmesh Pro font from Image ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      Do you mean a custom font from an image? I covered that here ua-cam.com/video/nBcP7FaDPE0/v-deo.html

  • @marc8482
    @marc8482 3 роки тому

    *Can you please* make the *tutorial* for the camera smooth movement in the middle of player-cursor distance.
    You said in comments it's done easily with cinemachine, but we can't figure out exactly how to do it.
    (ps. 2D TopDown game)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      I covered that here ua-cam.com/video/fuGQFdhSPg4/v-deo.html
      You calculate the direction and distance towards the mouse, then the camera position will be playerPosition + dirToMouse * (distanceToMouse / 2f)

  • @vusien
    @vusien Рік тому

    I have this issue when my cinemachine doesn't work when i attach my player to it. My project can float away, player spawns in different wierd ways or else. Maybe you know how to fix this?:(
    P.s. I made Player as a prefab and all the issues are gone.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +1

      You project floats away? What does that mean?
      If you set Cinemachine to follow a game object it will follow that game object, it shouldn't float away from that object unless that object is hte one floating away

    • @vusien
      @vusien Рік тому

      I have my Background, Foreground and Player objects and they all floats slowly into the down left corner of the screen, the only thing that can stop them from doing this is to remove Player from Follow field in the Cinemachine
      I see, but why my GameObjects might float away? I tried to make new one and i saw the same issues

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      Look in the Scene view in order to identify if it is those objects that are randomly moving away or if it's just the camera moving

    • @vusien
      @vusien Рік тому

      In the scene view its all GameObjects, Canvases and MainCamera that are floating away, but i tried to remove Cinemachine and add a new one and now my character is getting squeezed on Y axis

    • @vusien
      @vusien Рік тому

      thank for your time! :)

  • @ksinjao6113
    @ksinjao6113 3 роки тому +1

    Я украинец но люблю смотреть Code Monkey=)))

    • @ksinjao6113
      @ksinjao6113 3 роки тому

      Никто не узнает что я написал XD

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      Thanks for watching! Google Translate is pretty great!

  • @aleksp8768
    @aleksp8768 3 роки тому

    Code Monkey

  • @devforfun5618
    @devforfun5618 3 роки тому

    i guess by using tiles you can automatically set the bounding box to the tiles corners

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      Yeah you could use the TilemapCollider as the bounds

  • @oyunlarveparodiler3221
    @oyunlarveparodiler3221 3 роки тому +2

    Pog

  • @ori4854
    @ori4854 3 роки тому +1

    Hey I was wondering if u could teach how to remake fortnite I kinda wanted to bring back og fortnite or just my own online battle royale that every server can have a minimum of 3 players and a 1v1 game mode for 2 players and a lobby lol

  • @Flyingchris2249G
    @Flyingchris2249G 3 роки тому

    Your channel is to me now what Brackeys was 2 years ago. But please please, pretty please can you switch to dark mode?

  • @jessicagolfman4497
    @jessicagolfman4497 3 роки тому

    Can you please help me with a Level for my game? It’s gonna be really hard to make on my own.

  • @misterkuda704
    @misterkuda704 3 роки тому

    Me with a fps camera:

  • @ZgavY
    @ZgavY 3 роки тому

    I don't even know how to make a camera

  • @temporaryaccount6325
    @temporaryaccount6325 3 роки тому

    You won’t break me UA-cam, I’m not buying fucktube premium!!!!