2D Toolkit Forum

2D Toolkit => Support => Topic started by: Roamer on December 18, 2013, 07:31:45 pm

Title: [Bug?] - tk2dSprite + Polygon Colliders
Post by: Roamer on December 18, 2013, 07:31:45 pm
So I have a character that consists of:


All of my sprites have polygon colliders mapped directly to the sprites edges.

I'm using this script to turn the sprite based on mouse position:

(http://puu.sh/5QSRz/f6b937fb7e.png)

This works.

-> Now the bug is, if the sprite that I'm flipping is in a sprite-sheet and NOT a separate single sprite in the sprite-collection, the sprite flips, but the polygon collider does not. If I manually click FlipX in the editor in scene mode it works fine, as soon as I enter game mode it does not work. Trimmed box works fine.

Also, the head sprite flips fine, so I'm guessing this only happens if the sprite is in a sprite-sheet and has a polygon collider, like I said.

Also, maybe this isn't a bug after all and I'm making some dumb mistake or something, in that case I'd appreciate any input.

As always, thanks in advance!
Title: Re: [Bug?] - tk2dSprite + Polygon Colliders
Post by: Roamer on December 18, 2013, 07:51:21 pm
Upon further investigation, this is definitely weird.

Polygon colliders will only flip on calling FlipX or FlipY, IF your are flipping the attached sprite ABOVE it in the hierarchy.

For example, this works, and can be used as a temporary workaround:

(http://puu.sh/5QUne/6b5eb50e4c.png)

(http://puu.sh/5QUp7/861a292216.png)

This flips "Blank", flipping everything below it. Make sure it has a blank sprite attached that has its attachpoint and anchor point in the same spot.

Is this behaviour wanted or is it really a bug?
Title: Re: [Bug?] - tk2dSprite + Polygon Colliders
Post by: unikronsoftware on December 19, 2013, 12:01:33 am
Are you using 2d or 3d colliders? If you can isolate this in a simple test case I'd appreciate a repro case. It may well be a bug, and it will save a lot of time tracking it down if I had a repro to work with. Email support if possible
Title: Re: [Bug?] - tk2dSprite + Polygon Colliders
Post by: Roamer on December 20, 2013, 01:33:28 pm
I HAVE to use 3D colliders seeing as the polygon option in the sprite collections generates a mesh collider on the sprite in question, something that isn't possible for RigidBody 2Ds.
Title: Re: [Bug?] - tk2dSprite + Polygon Colliders
Post by: unikronsoftware on December 20, 2013, 05:05:06 pm
ok. can you create a repro case for this? If not, I'll have to give you some more things to try and work out what exactly is hapenngin and why.