Hello Guest

Author Topic: [QUESTION] 2DTK Camera Has Me Completely Confused!  (Read 6729 times)

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
[QUESTION] 2DTK Camera Has Me Completely Confused!
« 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.  ;)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #1 on: July 09, 2013, 05:29:11 pm »
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).

dlmrky

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #2 on: July 09, 2013, 08:07:07 pm »
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.

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #3 on: July 09, 2013, 11:14:11 pm »
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).

profanicus

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 167
    • View Profile
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #4 on: July 10, 2013, 12:36:06 am »
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. :)

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #5 on: July 10, 2013, 01:04:46 am »
Alright bro,
I'm DL'ing the 2.1 beta now.

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #6 on: August 31, 2013, 02:52:56 am »
Using Fit Height is it possible to Right Align instead of Center it?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [QUESTION] 2DTK Camera Has Me Completely Confused!
« Reply #7 on: August 31, 2013, 12:05:30 pm »
No, you should use anchors if you want to align to any other point.