2D Toolkit Forum

2D Toolkit => Support => Topic started by: jrhee on February 03, 2014, 04:15:18 am

Title: Scaling sprite groups
Post by: jrhee on February 03, 2014, 04:15:18 am
Hi,

Just wondering if there are any plans to allow baking scale for nested sprites? I'm making modular buildings which are comprised of many precisely aligned, grouped sprites; when I scale the parent transform everything scales correctly, but when I try to bake the scale down to the child objects to keep batching intact, the alignment of the objects breaks.

Thanks!
Title: Re: Scaling sprite groups
Post by: unikronsoftware on February 03, 2014, 10:55:29 am
It should work, except in some cases where it can't bake scale - unlikely thats the case in yours though. Can you create repro scene and email support, please? Should be easily fixed with a repro.
Title: Re: Scaling sprite groups
Post by: jrhee on February 04, 2014, 05:14:31 pm
For anyone else who might run into this, adding the line below fixes it. Thanks Dinesh for the quick fix!

Code: [Select]
static void BakeRecursive(Transform node, Vector3 accumulatedScale)
{
node.localPosition = Vector3.Scale( accumulatedScale, node.localPosition ); // Add this
Title: Re: Scaling sprite groups
Post by: unikronsoftware on February 04, 2014, 05:31:49 pm
Its merged into the codebase too, so it'll be in the next release.