Camera Zoom in Unity with Cinemachine {Keyboard & Mouse}
Вставка
- Опубліковано 28 сер 2021
- In this video I will show fellow Unity Developers or aspiring Game Developers how to zoom in and out with cinemachine.
💖 Support my videos on Patreon ► / obsessivegames
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
🙋 LINKS TO CHECK OUT 💗
If you need any assets and would like to see what the Unity asset store has to offer, then head right to the Unity store here ► bit.ly/39bxPvy
💗 50% off selected Unity Asset Store special ► bit.ly/39hri2t
Learn more with unity premium, go check it out!
📚 Unity Learn Premium ► bit.ly/3xBfKkh
If you want to take your game development career to the next level, make sure to look at Unity Pro or Unity Plus:
🔗 Unity Pro ► bit.ly/3O06wTP
🔗 Unity Plus ► bit.ly/3mHfdad
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
✨Connect on more platforms ✨
📷 Instagram ► / obsessive_games
🐦 Twitter ► / gamesobsessive
🥶 Facebook ► / obsessivegames
💬 Discord ► / discord
💨 Wishlist ► bit.ly/3kvM7Jn
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Welcome to Obsessive Games and on this channel, I show you how to create games and show you tips and tricks with Unity.
The current indie game in progress is an Action Role-Playing game called Guild Hall Adventures, I will show you what unity game development methods I use to complete games with Unity 3D.
Consider subscribing for game development tutorials and devlog videos with everything GameDev related, create your own indie games with the help I provide.
👍 Like and Subscribe! 💖
♥ Subscribe - bit.ly/2WkqqE4
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
✨Other Tutorials ✨
📷 How to make a Singleplayer FPS Game ► bit.ly/3aEPWud
📷 How to shoot in an FPS Game ► • How to shoot in my FPS...
📷 How to gather a tree in Unity ► • How to gather a TREE i...
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#unity #gamedevelopment #cinemachine
#obsessivegames
Camera Zoom in Unity with Cinemachine
indie games,indie game,unity3d,low poly,game dev,gamedev,computer science,game development,unity game development,unity game dev,indie game development,cinemachine unity,cinemachine,cinemachine tutorial,cinemachine follow,unity tutorial,indie game dev,unity,game developer,indie gamedev,unity cinemachine,unity 3d tutorial,unity 3d,obsessive games,unity tips,virtual camera
Nice tutorial, exactly what I was looking for, thanks! :)
(Remember to uncheck "Save during play", my Cinemachines camera by default has it enabled).
Thanks a lot! You're the best, man. 🚀
Great videos just subbed keep up the good work!
Thank you. The hell I went through trying to code my own camera controller then I found Cinamachine. I am so new to coding its not even funny. Thank you again.
Thanks for the tutorial. Really helped me a lot. Thank you!
I am so glad this helped you! cheers :)
Thanks a bunch for this tutorial, no nonsense and straight to the point.
After looking around a little I've come back to ask; How would one code a limit to the zoom effect? (Say the Camera distance in the body section having a minimum zoom of 35 and a maximum of 15?) Hope this makes sense, many thanks Obsessive Games.
Super happy you enjoyed it!
I actually did answer this before and I think this comment helped, also if the below doesn't help, come hop into discord and I'll personally assist you:
Here is the link to the pastebin, there is an "if (cameraDistance < 0) which does the check and the there is a float variable maxCameraDistance which is also SerializeField to be seen in the inspector to be set, but you can set it at the top as well. If you do have questions regarding any of this, please do let me know.
Pastebin link: pastebin.com/QqEYmqbX
wow this is it what i've been looking for, changing the distance, thanks man.
but for my purpose i need it simple by pressing button, do you know how to implement it with keyboard? i mean i want to implement it with gesture touchscreen, but for now i want to bypass it first with keyboard input.
You could use the new input system and see how to send event like keys to do a zoom.
This video will show how to send the events: ua-cam.com/video/Yjee_e4fICc/v-deo.html
thx for the video, but how could I change the camera rotation too?
Hey! thanks for watching the video, I have another video which is the First Person Movement video, it specifies from around 6min with the mouse look at script where you can adjust the gameobject transform.rotation with euler and how I did it to look left and right, if you still need more help, I am more than happy to assist in the Discord group as well.
i love the video. How do you switch multiple cinemachine virtual cameras???
You can use the depth filter and raise the value as far as I know, I am more than happy to assist over discord if needed.
@Obsessive Games Thank you for replying. would that. could you share your discord server link?
@@kaloshabuthapa3284 here you go: discord.com/invite/QybEbjm
Finally can see what the NPCs looks like by scrolling closer, want to see more Unity Tutorials that I made? Check out this playlist: bit.ly/3CcDAC8
what plug in(s) do you use in VS code to get intellisense for unity? (if thats the right word. i mean the key word prediction)
So all the extensions I have in VS code that are unity related are:
Debugger for Unity
Unity Code Snippets
Unity Snippets
Unity Tools
I hope that helps :)
@@ObsessiveGames super awesome, i installed all of them and now have exactly what i was hoping to find!!! Thank you very very much
My script dosent recognize the 'Using Cinemachine' referance, even after I restarted Unity
And it is installed? more to happy to help over discord as well
I tried to implement this using the Input Actions (Input System), but it doesn't work.
The debug shows that it is reading the mouse scroll up and down, but your code doesn't affect the camera.
Any help would be great, thank you!
Hey Az, have you made sure that you did indeed drag and drop the virtual camera into the slot? if you did then I am not 100% sure what is going on, but you could always hop on discord and when I am online you can always pop me a message and I can have a look at what is actually going on :)
@@ObsessiveGames I see the problem now. I am using 3rd Person Follow and not Framing Transposer. Does this only work with Framing Transposer? Or can I modify the code to work with 3rd Person Follow?
@@Az555 There should be a way, I saw you joined the discord, so we will chat on that side. ;)
*edit: @ if (componentBase is CinemachineFramingTransposer) if you use a different camera style, then you need to change each of this statement to is Cinemachine3rdPersonFollow and as Cinemachine3rdPersonFollow.
so how to set min and max for the zoom distance?
Here is the link to the pastebin, there is an "if (cameraDistance < 0) which does the check and the there is a float variable maxCameraDistance which is also SerializeField to be seen in the inspector to be set, but you can set it at the top as well. If you do have questions regarding any of this, please do let me know.
Pastebin link: pastebin.com/QqEYmqbX
@@ObsessiveGames yes it work… thx brooooo
How do i set a max camera distance when i'm too far away, and when i'm too close?
Let me send a pastebin for the max camera distance on what could be done for this script and ill add some comments as well. Will send in a sec.
Here is the link to the pastebin, there is an "if (cameraDistance < 0) which does the check and the there is a float variable maxCameraDistance which is also SerializeField to be seen in the inspector to be set, but you can set it at the top as well. If you do have questions regarding any of this, please do let me know.
Pastebin link: pastebin.com/QqEYmqbX
@@ObsessiveGames bro thats not working :(((
@@ObsessiveGames just what i needed, thx!
I have a promblem with this, my character cant move anymore becuase of the script
If you do require more assistance with this then I am more than happy to hop on discord to assist :)
how to do it with touch?
I will look into that and create a new episode regarding that! Thanks for the idea
is it work with screen space- camera canvas?
This is only for cinemachine, it would work for anything that is using cinemachine, the componentbase can just be changed to let the others work 😀
@@ObsessiveGames ok so if i changed it to mobile then its only change the input.getaxis right?
@@farhanmaulidan3306 not sure for mobile, you could always join the discord and show a bit more of what you are trying to do :)
this method only works with one type of camera. and is not universal. not easier to use ADD Extension => CinemachineCameraOffset?
Not 100% sure about "not easier to use ADD Extension". Is this something to be added to make it universal?
@@ObsessiveGames Add Extension => CinemashineCameraOffset.
during the experiment, I noticed that when using offset, the camera collision does not work
perhaps this is still not the best solution.
and for each camera you need to look for your own approach.
good luck!