Hello Guest

Author Topic: questions about 'use tk2dcamera'  (Read 2993 times)

David Kalina

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 26
    • View Profile
questions about 'use tk2dcamera'
« on: July 18, 2013, 06:57:10 pm »
OK, so we've decided that it'll be easiest for our (now) 2D game to have sprites instantiated at pixel size.

This way, a 256x128 texture added to a sprite collection will be instantiated at world unit size 256x128.

I've checked "use tk2dcamera" in order to accomplish this... even though I am not using a tk2dcamera to render my game world.  Are there any side effects of that checkbox that I need to be aware of?

Also, is there a single call I can make into a tk2dsprite to get its size in world coordinates (accounting for hierarchy scale, tk2dsprite scale, and source sprite size)?  The aforementioned sprite will have a transform.scale=1,1,1 and a tk2dsprite.scale=1,1,1... so how do I know it's actually 256x128?

Thanks!
David

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: questions about 'use tk2dcamera'
« Reply #1 on: July 18, 2013, 07:04:22 pm »
Hi David,

There is no problem to using the "Use tk2dCamera" tickbox. It is just shorthand for 1 pixel per meter. In the next version of 2D Toolkit, you will be able to specify the size in pixels per meter too.

About your second question - tk2dBaseSprite.GetUntrimmedBounds() returns the size of the sprite in Unity units, but that is excluding the hierarchy scale. You shouldn't really be using hierarchy scale in most cases anyway, as it is likely to break batching.