Understanding Orthographic Size in Unity

  Рет қаралды 86,194

Press Start

Press Start

Күн бұрын

Пікірлер: 150
@pressstart6864
@pressstart6864 6 жыл бұрын
Copy & Paste Source Code: pressstart.vip/tutorials/2018/06/14/37/understanding-orthographic-size.html
@JD3DGAMER
@JD3DGAMER 5 жыл бұрын
for 9:19 Aspect Ratio, it is not working
@mopto7833
@mopto7833 4 жыл бұрын
Hi What resolution of rink you had? My rink is cropping on top and bottom My resolution is 1242x2208 (WxH)
@brayanlucca7437
@brayanlucca7437 3 жыл бұрын
I dont mean to be so offtopic but does anyone know a trick to get back into an instagram account?? I was stupid forgot the password. I appreciate any tips you can give me.
@axelaldo4363
@axelaldo4363 3 жыл бұрын
@Brayan Lucca instablaster ;)
@brayanlucca7437
@brayanlucca7437 3 жыл бұрын
@Axel Aldo i really appreciate your reply. I found the site on google and I'm in the hacking process now. Seems to take a while so I will reply here later with my results.
@tikebkaatar
@tikebkaatar 4 жыл бұрын
Thank you, this is the first video that actually addresses the problem and most scenarios to do with aspect ratio
@willh69
@willh69 4 жыл бұрын
I'm pretty new to C# coding, super grateful that we have resources like this for free on the internet. It all seems so complicated but when you break it down logically like this it all makes sense Thanks Press Start
@christianschuster4171
@christianschuster4171 5 жыл бұрын
Fantastic! This is the best explanation I’ve seen so far. The examples help a lot. Thank you for putting in the effort!
@fenix3752
@fenix3752 4 жыл бұрын
What is the rink?
@DracoGrim
@DracoGrim 4 жыл бұрын
@@fenix3752 RInk is the image/sprite he uses, which is a hockey field (ring/rink)
@fenix3752
@fenix3752 4 жыл бұрын
@@DracoGrim thanks man
@mivuh
@mivuh 2 жыл бұрын
That was by far the most efficient way to solve my problem with my first game. That was the last part i was missing, thank you so much.
@thesolitaryowl
@thesolitaryowl 3 жыл бұрын
Wow. This is the first video that actually explains this problem really well. I've been searching for an hour trying to solve this issue.
@alexlik4197
@alexlik4197 Жыл бұрын
Thank you so much! You have no idea how long I've been looking for something like this! Even though this video is 4 years old at this point, it helped me a ton!
@Aereton
@Aereton 2 жыл бұрын
You've helped me understand how camera sizes and screen resolutions work together. Thank you so much, great video short and concise!
@javierfernandez6030
@javierfernandez6030 2 жыл бұрын
This is the best explanation I've found so far.. crazy it was made 4 years ago! Thanks a lot!
@mitul1294
@mitul1294 3 жыл бұрын
Thank you for explaining one of the major and common problem in such a simplistic manner
@jakubneska1694
@jakubneska1694 3 жыл бұрын
Thanks a lot! I struggled for a while trying to find something explaining how orthographic size relates to objects positioning! And your video explained everything perfectly! Couldn't do minimap for my game without it!
@skiesquiggles7319
@skiesquiggles7319 5 жыл бұрын
Literally exactly what I needed, many thanks to you, friend!
@pressstart6864
@pressstart6864 5 жыл бұрын
Awesome, glad I could help :)
@DanielLeightonArt
@DanielLeightonArt Жыл бұрын
This and your edge collider hack video really helped solve a problem that had me stuck. Thank you!
@GrosssDude
@GrosssDude 3 жыл бұрын
Absolutely amazing. I have spent HOURS trying to figure this out. Thank you, thank you, thank you.
@Ghatos
@Ghatos 3 жыл бұрын
My god, THANK YOU! I've been trying to code something simillar and your video made me realise why Screen.width / Screen.height was giving me back the wrong values, I had to write it like this: *(float)* Screen.width / *(float)* Screen.height Thank you a lot for this video, that issue was driving me nuts.
@pedroduran8927
@pedroduran8927 2 жыл бұрын
I have to thank you very much for this simple and effective solution! it worked great for me for my board game with both Phone and Tablet support!
@MadOliveGaming
@MadOliveGaming Жыл бұрын
I was very confused why this worked for everyone but me. Guess what... my script was not check marked so it was disabled all the time xD. Great video, i have a phone with a weird resolution so i needed this to be able to play my own game lmao
@wimbo_learn_music
@wimbo_learn_music 2 жыл бұрын
Exactly what I needed. Perfectly explained. Thanks!
@FortbloxNET
@FortbloxNET 3 жыл бұрын
this is exactly what i was searching for, for years. thank you!!!!!!!!!!!!!!!!!!!!!
@NiclasGleesborg0
@NiclasGleesborg0 5 жыл бұрын
Great explanation :)
@alexbukin982
@alexbukin982 6 жыл бұрын
Thank you very much! Video and sound is awesome, speech is great and it is easy to understand you! Even I am from Russia I did it and it works, thanks again!
@lathspell2885
@lathspell2885 3 жыл бұрын
Thanks, I haven't tried it yet but I'm sure it will work. You explained it very well.
@denn501
@denn501 Жыл бұрын
TYSM!! This is exactly what I was looking for!!!
@IndeedJoe
@IndeedJoe 5 жыл бұрын
Great tutorial man!
@pressstart6864
@pressstart6864 5 жыл бұрын
thanks man!
@murlocsenpai9727
@murlocsenpai9727 3 жыл бұрын
Very well explained, thanks for the video.
@LuyoYoo
@LuyoYoo 6 жыл бұрын
This was so useful! Thank you!
@mikulashoblik8039
@mikulashoblik8039 5 жыл бұрын
Thank you very much for this solution. It worked really well for me :)
@xkyfal18
@xkyfal18 5 жыл бұрын
Good job, it helped a lot, thanks for posting ;)
@xliquid1400
@xliquid1400 5 жыл бұрын
Damn u are so so helpful, you are truly underrated
@dand4604
@dand4604 5 жыл бұрын
How are you so calm? I'm struggling to keep my brain from revving to 12k rpm. Don't know what it's like to be normal anymore
@alleyesonme1432
@alleyesonme1432 4 жыл бұрын
Good Job! Nice explanations suited for beginners. Waiting for next videos, subscribed! BTW, what is rink?)
@sparttenomega45
@sparttenomega45 4 жыл бұрын
This worked for me. Thanks!
@violentgamer5910
@violentgamer5910 4 жыл бұрын
Thank you for this Great Tutorial I really Liked it!!
@mmdjn
@mmdjn 2 жыл бұрын
Thank you for explaining and example
@raingame_
@raingame_ 5 жыл бұрын
Thanks! U got my subscription!
@АлександрЕрёменко-е5б
@АлександрЕрёменко-е5б 5 жыл бұрын
Thanks for the video, it helped a lot!
@pressstart6864
@pressstart6864 5 жыл бұрын
Glad I can help!
@GurmeetSingh-ui8fd
@GurmeetSingh-ui8fd 3 жыл бұрын
Hello, good tutorial but what if you are not using spriteRenderer but instead the game object? i created a plane out of the game object and i want to fit the camera to the game object x and y axis. I tried modifying your code where instead of the sprite renderer, i used the transform of the plane where it calculates the x axis and the z axis but still does not work. Do you have any idea for this?
@kebalbadal4224
@kebalbadal4224 4 жыл бұрын
Fantastic bro Helped a lot Thank you bro
@olegfrolovdesign
@olegfrolovdesign 6 жыл бұрын
Well explained 👌
@carlososuna1194
@carlososuna1194 4 жыл бұрын
you're the best, excellent bro!!
@hyperactiveguy3583
@hyperactiveguy3583 Жыл бұрын
Thanks, it helped me a lot!
@intrer8601
@intrer8601 4 жыл бұрын
Thanks! This was exactly what I was looking for!
@fenix3752
@fenix3752 4 жыл бұрын
What is the rink
@intrer8601
@intrer8601 4 жыл бұрын
@@fenix3752 What do you mean?
@fenix3752
@fenix3752 4 жыл бұрын
@@intrer8601 what is the rink thing he is using in the tut
@intrer8601
@intrer8601 4 жыл бұрын
@@fenix3752 Oh, I used it for my own project, I didn't use the rink thing in the tutorial.
@fenix3752
@fenix3752 4 жыл бұрын
@@intrer8601 than what did you used plz tell me help needed
@greggiles8725
@greggiles8725 6 жыл бұрын
This tutorial is 🔥 🔥 🔥 🔥
@pressstart6864
@pressstart6864 6 жыл бұрын
Thank you :)
@서리-v3f
@서리-v3f 5 жыл бұрын
thanks for the video, very helpful !! :D
@therightpic
@therightpic 4 жыл бұрын
Excellent explanation. I have been trying to figure out these kinds of things for a long time and you do a great job on your videos. Are you still making videos? It doesn't seem like you have anything for a while.
@ShironatsuKun
@ShironatsuKun Жыл бұрын
Wow I've been looking for a solution for this issue for weeks. I was using Cinemachine's TargetGroup Camera to replicate this behavior but the TargetGroup feature doesn't work with the PlayerMovement Claming that I'm using so this simple method saved me.
@Omhetehmo
@Omhetehmo 5 ай бұрын
Man, you are best!
@inori5138
@inori5138 5 жыл бұрын
It workeddddddd... I was looking for 1 month oooooloohohhohohohh...
@diegosuarez5473
@diegosuarez5473 6 жыл бұрын
your amaziiiiing Brooooo! i am new suscriber!! Thanks!!!!!!!!!!!!!!
@pressstart6864
@pressstart6864 6 жыл бұрын
Welcome brother :)
@amazinggamers356
@amazinggamers356 Жыл бұрын
Great Work
@xamretssam
@xamretssam 4 жыл бұрын
Thanks, very helpful!!!
@sumitcutevil9260
@sumitcutevil9260 2 жыл бұрын
this video is a life saver tysm....
2 жыл бұрын
You are a legend!
@flakylyte4811
@flakylyte4811 6 жыл бұрын
Hey, nice video!!
@Me-jy6cd
@Me-jy6cd 2 жыл бұрын
Great tutorial! After a long search finally a good explanation. Does the formula for calculating the orthographic size have a general mathematical reference or name?
@gaborbocskai5420
@gaborbocskai5420 4 жыл бұрын
Super helpful!!!
@franchisethebull
@franchisethebull 2 жыл бұрын
Brilliant dude
@ShacharOz
@ShacharOz 4 жыл бұрын
wonderful stuff! thanks a lot. have any idea how to do the Fit to Fill? so there will be no black borders from either portrait or landscape?
@emilkronholm6246
@emilkronholm6246 5 жыл бұрын
10/10 thank u! :D
@Ferenc-Racz
@Ferenc-Racz Жыл бұрын
Huge thank you! :)
@microexpresionblog
@microexpresionblog 4 жыл бұрын
Thanks so much man!!!
@zeebigz2498
@zeebigz2498 5 жыл бұрын
how do you fit both width and height of the playground edge to the screen size at same time. you have shown weight and height edge fit on screen edge . but how to you do at same time???
@pressstart6864
@pressstart6864 5 жыл бұрын
Unfortunately that's not how screen's work. It would be impossible to factor in all screen aspect ratios to have a screen fit both height and width of an object. You could instead alter your object to fit the width and height of the screen, but that's a whole different video.
@sudarshan4433
@sudarshan4433 5 жыл бұрын
Very helpful. can we use same with canvas? i have problem when screen resolution changes my sprite images which are not part of canvas are get cut off.
@random_precision_software
@random_precision_software 5 жыл бұрын
I'm looking for how to have different screen aspects for different scenes. It seems of you have landscape on the menu scene it does that for all other scene..where I want portrait. How world I do this?
@plasmapig1356
@plasmapig1356 4 жыл бұрын
Is there a way to make the view orthographic on one axis and perspective on another so if you move closer and further away, things would only get bigger/smaller on one axis? I’m talking about 3D not 2D games.
@matronator
@matronator 2 жыл бұрын
Amazing video! After searching so many tutorials, this is finally the one that actually does what I want! Thank you! One question though: Now it scales based on the screen size only. But on devices like iPhone X that have the weird display with the cut out and round corners it's not really desired. Is there some way to make it scale not to screen size, but the safe area of the screen only?
@sudeepacharya1492
@sudeepacharya1492 2 жыл бұрын
Hi, thank you for the tutorial. But this doesn't work when the orthographics camera is rotated 90 on x-axis. Please help! ANd also please make tutorial for Perspective view as well!
@danieljayne8623
@danieljayne8623 4 жыл бұрын
You sir have saved my ass in LD 47 :D
@serpaolo7413
@serpaolo7413 4 жыл бұрын
Does this work for Platformer games (Mario Style) where the character is constantly moving and the camera must follow him?
@risingdagger5416
@risingdagger5416 4 жыл бұрын
thx u made it so ez now
@MagotizilaBr
@MagotizilaBr 5 жыл бұрын
Hey guys how do i set a start camera position, i'm making a 2d game and i want the camera to stay in the left border where start the game but if the user changes the resolution the camera goes further and swallow a little piece of the scene what should i do to fix this? How do i make the camera stay in the start left border without swallow in it?
@pressstart6864
@pressstart6864 5 жыл бұрын
If you know where the edge of your game is, just set the cameras position to the position of the edge plus half screen width.
@MagotizilaBr
@MagotizilaBr 5 жыл бұрын
@@pressstart6864 ooh thanks man it worked ;) thanks for helping me from the bottom of my heart ;)
@EnderElectrics
@EnderElectrics 4 жыл бұрын
@@pressstart6864 I tried that. What if it doesn't work?
@keremaslan1988
@keremaslan1988 4 жыл бұрын
what should i use instead of rink since my game is more like a normal game
@gabrielulate1212
@gabrielulate1212 4 жыл бұрын
THANK YOU SO MUCH!!!!!
@Ashkan-yf8eu
@Ashkan-yf8eu 2 жыл бұрын
Thank you!
@rmajumdar82
@rmajumdar82 3 жыл бұрын
Thanks a lot!
@et9277
@et9277 4 жыл бұрын
Thank you thank you thank you!
@kevinkoolen
@kevinkoolen Жыл бұрын
Legend video
@simonk5361
@simonk5361 6 жыл бұрын
Hello Press Start, it is a nice Video, but useless for me because i dont have an Orthograpic camera. I have a Perspective Camera and the script dont work with this type of camera. So, do you want to make a whole new Video about the zooming from a Perspective cam? Would be nice!
@pressstart6864
@pressstart6864 6 жыл бұрын
I might make a more in-depth video down the road, but I covered this topic in one of the more recent videos. Here's the link: kzbin.info/www/bejne/apCrhp93e9Grrbc
@EremesNG
@EremesNG 4 жыл бұрын
Ty a lot bro
@watercat1248
@watercat1248 Жыл бұрын
Cool what happened if do that in not orthographic camer ?
@sanketjadhav9981
@sanketjadhav9981 3 жыл бұрын
how cam we do this for perspective camera?
@mananmehta2320
@mananmehta2320 4 жыл бұрын
What if I'm not have sprite background, instead a skybox colour???
@hiepuc6315
@hiepuc6315 4 жыл бұрын
thank you so much
@Origined
@Origined 4 жыл бұрын
How to get rink???
@PeterMilko
@PeterMilko 4 жыл бұрын
For virtual cameras, public CinemachineVirtualCamera CinemachineVirtualCamera; public SpriteRenderer ScreenSizeSprite; void Start() { float orthagraphicSize = ScreenSizeSprite.bounds.size.x *Screen.height / Screen.width *0.5f; CinemachineVirtualCamera.m_Lens.OrthographicSize = orthagraphicSize; }
@lI-tm4qx
@lI-tm4qx 3 жыл бұрын
Hello , Peter I think this is exactly what I'm looking for. I'm using cinemachine virtual camera on my game and I cant get it to work properly, here's my script attached to my main camera public SpriteRenderer screenAdapt; public CinemachineVirtualCamera CinemachineVirtualCamera; void Start() { float screenRatio = (float)Screen.width / (float)Screen.height; float targetRatio = screenAdapt.bounds.size.x / screenAdapt.bounds.size.y; CinemachineVirtualCamera.m_Lens.OrthographicSize = targetRatio; if (screenRatio >= targetRatio) { Camera.main.orthographicSize = screenAdapt.bounds.size.y / 2; } else { float differenceInSize = targetRatio / screenRatio; Camera.main.orthographicSize = screenAdapt.bounds.size.y / 2 * differenceInSize; } }
@PeterMilko
@PeterMilko 3 жыл бұрын
@@lI-tm4qx You didn't set it up right. Watch a tutorial.
@mauricepickartz797
@mauricepickartz797 4 жыл бұрын
what does the "rink" is?
@MuhammadZeeshan-gm3uq
@MuhammadZeeshan-gm3uq 4 жыл бұрын
what about UI canvas image can we set the camera size according to UI image on canvas??
@bstrouble
@bstrouble 3 жыл бұрын
Thats what I wanna know
@user-pw5do6tu7i
@user-pw5do6tu7i 4 жыл бұрын
Make sure to tag the camera as "MainCamera" otherwise you get a nullObject refference
@kieranpont7899
@kieranpont7899 5 жыл бұрын
Life saver.
@gildas7200
@gildas7200 4 жыл бұрын
Why is mine so zoomed in?
@robbeldevelopmentstudio9888
@robbeldevelopmentstudio9888 5 жыл бұрын
Thanks!
@christinedelire3974
@christinedelire3974 2 жыл бұрын
So what is Rink actually ?
@chenariana3482
@chenariana3482 5 жыл бұрын
why it shows " camera does not contain main"....?
@pressstart6864
@pressstart6864 5 жыл бұрын
Tag your camera as the main camera
@chenariana3482
@chenariana3482 5 жыл бұрын
@@pressstart6864 Thanks a lot!!
@ayoubnachit145
@ayoubnachit145 4 жыл бұрын
What is Rink
@mohansaiteki8012
@mohansaiteki8012 4 жыл бұрын
Your charm mate
@klemenremec
@klemenremec 4 жыл бұрын
Great video, but as I implemented it in my game of pong for android, it gets cut off at 18:9 screen ratio... works with every other screen size or ratio
@marufm8195
@marufm8195 4 жыл бұрын
if your issue is with the border wall colliders this video might help kzbin.info/www/bejne/qJ2vfqqEfppmhdE
@mahmoudshaddad7411
@mahmoudshaddad7411 2 жыл бұрын
thank you
@mr.casual2304
@mr.casual2304 4 жыл бұрын
Whenever I do this and I open the apk version it never works (just the y axis)
@jnantes0
@jnantes0 4 жыл бұрын
Same here, it worked for me during delopment and for android, but not for PC builds. Could you find your solution?
@michaeldavis6993
@michaeldavis6993 4 жыл бұрын
Yeah so I dont have a Main camera just a camera, and i got an error saying camera has no definition called "Main"
@intrer8601
@intrer8601 4 жыл бұрын
Then just make add this to the start of your code: “public Camera camera”, then drag the camera in the inspector and instead of calling it camera.main.orthographicsize in the script just call it “camera.orthographicsize”.
@michaeldavis6993
@michaeldavis6993 4 жыл бұрын
@@intrer8601 I'll try it
@bhushanrocks412
@bhushanrocks412 5 жыл бұрын
thanks
@pressstart6864
@pressstart6864 5 жыл бұрын
You’re welcome
@aniketkanhekar9071
@aniketkanhekar9071 5 жыл бұрын
I am confused what is rink
@abwuds7208
@abwuds7208 5 жыл бұрын
www.google.com/search?q=rink&rlz=1C5CHFA_enFR739FR739&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjR2tHa8M3jAhUyzYUKHZmyD0UQ_AUIESgB&cshid=1563982469301000&biw=1440&bih=766&dpr=2
@bhushanrocks412
@bhushanrocks412 5 жыл бұрын
its a background image
Unity - Mobile Panning with a Perspective Camera
6:24
Press Start
Рет қаралды 38 М.
Unity Movement [RigidBody vs Translate]
9:00
Press Start
Рет қаралды 287 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Minecraft block vs Cloth Simulation
0:10
BlendySci
Рет қаралды 15 М.
How To Make Your Game Look The Same On All Mobile Screen Sizes - Unity Mobile Game Development
7:50
Awesome Tuts - Anyone Can Learn To Make Games
Рет қаралды 161 М.
Escaping Unity Animator HELL
18:18
Lost Relic Games
Рет қаралды 519 М.
Splines are Awesome!!!
11:13
Code Monkey
Рет қаралды 155 М.
Unity3D UI Tutorial - How to scale the canvas for all screen sizes
5:15
Pan, Zoom and limit camera movement - Unity 2D Tutorial
14:53
Shack Man
Рет қаралды 66 М.
How to make AWESOME Scene Transitions in Unity!
19:45
Brackeys
Рет қаралды 969 М.