Hello Guest

Author Topic: Zoom on 2D Toolkit Camera  (Read 12747 times)

paifu

  • Newbie
  • *
  • Posts: 1
    • View Profile
Zoom on 2D Toolkit Camera
« on: August 08, 2012, 10:14:39 am »
Is it possible to script a zoom In/Out on a tk2dCamera ?. Changing the OrthographicSize for exemple like we can do on a classic Unity Orthographic camera.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoom on 2D Toolkit Camera
« Reply #1 on: August 08, 2012, 07:41:44 pm »
Hi,

You can't, yet. The reason for this is that there are quite a few unresolved issues on zooming in - what happens to anchors, etc. Also the tk2dCamera's origin is on the bottom left so scaling that will zoom from the bottom left rather than the center, which will be annoying. If a normal camera wont work for you, drop me an email at support@unikronsoftware and I'll give you a patch with a scale number in there, just as long as you're aware the anchors probably won't work properly there...

pdform

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
    • The Balance Inc
Re: Zoom on 2D Toolkit Camera
« Reply #2 on: August 11, 2012, 09:57:43 pm »
Hi, I could realy use this patch. I'm not using anchors, so they wouldn't be a problem... I've sent them an e-mail too but, in the meanwhile, does anyone know a simple solution for this?

Hi,

You can't, yet. The reason for this is that there are quite a few unresolved issues on zooming in - what happens to anchors, etc. Also the tk2dCamera's origin is on the bottom left so scaling that will zoom from the bottom left rather than the center, which will be annoying. If a normal camera wont work for you, drop me an email at support@unikronsoftware and I'll give you a patch with a scale number in there, just as long as you're aware the anchors probably won't work properly there...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoom on 2D Toolkit Camera
« Reply #3 on: August 12, 2012, 12:06:10 am »
I've replied to your email - I am reluctant to post it until I get a chance to ensure it will work properly in all cases. I've added it to the todo though.

joberbichler

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Zoom on 2D Toolkit Camera
« Reply #4 on: August 17, 2012, 01:50:37 am »
So, can I make two cameras--one a normal orthographic and the other the tk2d camera--and have GUI attached to the tk2d camera's anchors and then have everything else in the normal camera and then have the normal camera in the tk2d camera and zoom in and out using the normal camera (without compromising the GUI size)?

Does that make sense? Is it logical?

/an artist trying to get into game dev

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoom on 2D Toolkit Camera
« Reply #5 on: August 17, 2012, 08:00:49 am »
Yup that's perfectly fine.

Edit: I should mention, please use the camera depth value to order the cameras. Set them up like this:
GameCamera - camera depth = 0, Clear Flags = Skybox / Solid / (what you'd normally have)
UICamera - camera depth = 1 (draws after GameCamera), ClearFlags = Don't Clear (i.e. don't wipe out the stuff the other camera's drawn)
« Last Edit: August 17, 2012, 08:43:21 am by unikron »