2D Toolkit Forum
2D Toolkit => Support => Topic started by: JBabz on July 09, 2013, 05:21:45 pm
-
Hey Guys!
I'll just cut to the chase:
I've been messing around, trying to get the 2DTK camera to work, in this manner, and there always seems to be one piece wrong in the puzzle whenever I make an attempt:
I need my camera to be orthographic and 2D (simple enough).
I need my camera to be in 16:9 aspect ratio, and to scale up or down with that ratio, but here's the clincher:
If the player sets his resolution as 4:3, instead of scaling to that resolution, I'd like the camera to simply "trim" off the edges of the camera.
Is this possible?
Thanks a ton, folks, these camera settings are really con-fuddling me. ;)
-
Hey there,
Yes! That's precisely what the scenarios the tk2dCamera is meant to solve. The issue with the currently released tk2dCamera (2.0) is that the Unity camera preview is buggy, and doesn't show the correct preview region. If you get 2D Toolkit 2.1 beta - the new and improved tk2dCamera in there will let you preview whats going on without any hassle.
In any case, what you wanna do is set up the tk2dCamera with a native resolution of 1280x720 (or any other 16:9 aspect) depending on the resolution the sprites are designed for, etc, and then add exactly ONE override - set AutoScale to FitHeight, and FitMode to Center. That should be it. What you're telling it is - when the resolution and/or aspect changes from the native resolution, to just scale it to fit height, ignoring what happens on either side.
With the tk2dCamera in 2.1 - you can actually preview what happens in scene view (you get 2 outlines signifying the native and preview resolutions).
-
Thanks for this, was just about to post a similar question regarding being able to see more of the scene view when I ZOOM on Google Chrome and the Override Autoscale Height fix it.
-
Wow. Fast reply, thanks! :D
But one more question:
How does the "size" setting impact the camera view? What is that size parameter, anyway? I saw it on the regular unity ortho camera too.
(As you can tell, I'm new to both unity and 2DTK, I've been looking through the user manual though).
-
Ortho size is basically half the physical viewing height of the camera.
Example: if you stacked 10 one-meter cubes in your scene such that they are centered to the camera in the game view, and set your ortho camera to size 5, then the cubes will fit exactly between the top and bottom edges of the game view. Set ortho size to 1, and you will see two of those one-meter cubes instead.
Personally I'd use the 2.1 beta and use the awesome new 'pixels per meter' setting instead. :)
-
Alright bro,
I'm DL'ing the 2.1 beta now.
-
Using Fit Height is it possible to Right Align instead of Center it?
-
No, you should use anchors if you want to align to any other point.