2D Toolkit Forum

2D Toolkit => Support => Topic started by: paifu on August 08, 2012, 10:14:39 am

Title: Zoom on 2D Toolkit Camera
Post by: paifu 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.
Title: Re: Zoom on 2D Toolkit Camera
Post by: unikronsoftware 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...
Title: Re: Zoom on 2D Toolkit Camera
Post by: pdform 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...
Title: Re: Zoom on 2D Toolkit Camera
Post by: unikronsoftware 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.
Title: Re: Zoom on 2D Toolkit Camera
Post by: joberbichler 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
Title: Re: Zoom on 2D Toolkit Camera
Post by: unikronsoftware 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)