2D Toolkit Forum

2D Toolkit => Support => Topic started by: ERR0 on November 27, 2012, 07:34:44 pm

Title: Animated Sprite collider not being created properly
Post by: ERR0 on November 27, 2012, 07:34:44 pm
So I have a number of tk2d animated sprites and when I click the "create a collider" button on one of them in the editor, it creates a collider at (0, 0, -100000) with a size of (0, 0, 0). I assume this is a bug because I thought it's supposed to automatically position and size the collider. Is there something I'm missing or a way I can fix this?
Title: Re: Animated Sprite collider not being created properly
Post by: unikronsoftware on November 27, 2012, 07:51:33 pm
That happens when you don't have a collider set up on the sprite itself. Go into the sprite collection editor, and set up a box collider on your frames.

This is so you can have frames of animations WITHOUT colliders, and other frames with colliders. What its thinking right now is that all frames don't have colliders.
Title: Re: Animated Sprite collider not being created properly
Post by: ERR0 on November 27, 2012, 08:53:44 pm
Awesome, that worked, thanks. Do I still need to check off the create collider checkbox on the animated sprite?
Title: Re: Animated Sprite collider not being created properly
Post by: unikronsoftware on November 27, 2012, 10:40:36 pm
Leave it on if your sprites have colliders. The real purpose of that is to create a hidden collider, for example if the default sequence didn't have colliders, but another one did.
Title: Re: Animated Sprite collider not being created properly
Post by: xikky on January 31, 2013, 06:01:17 pm
Thank you this one helped me too.

similar to this ... I cannot change the scale of a box collider on a sprite. The only way that the box collider can be scaled is by scaling the sprite itself. Am I missing something here?
Title: Re: Animated Sprite collider not being created properly
Post by: unikronsoftware on January 31, 2013, 11:07:55 pm
Isn't the box collider simply being animated? If you want to change it yourself, you probably want to set the collider type in the editor to unset / user defined.
Title: Re: Animated Sprite collider not being created properly
Post by: xikky on February 01, 2013, 01:48:34 pm
sorry I didn't explained my problem with enough detail.

I would like to scale the sprite's collider in the z axis. Thus making the box collider into a much longer rectangle. Should I set the collider type to user defined in this case (as you suggested above) or is there another way, to scale the collider only in the z axis? At the moment I can only fix the box collider width (at the z axis) by scaling the sprite's z axis.

Which would be the best practice for this?
Title: Re: Animated Sprite collider not being created properly
Post by: unikronsoftware on February 01, 2013, 02:13:38 pm
Open up the sprite collection editor, in settings, set collider depth to what you'd like it to be. Commit, and you're done.