2D Toolkit Forum

2D Toolkit => Support => Topic started by: murkantilism on July 13, 2012, 11:08:25 pm

Title: Polygon Collider - Problems with Character Controller [SOLVED]
Post by: murkantilism on July 13, 2012, 11:08:25 pm
I'm building a 2D platformer in Unity using TK2D for sprites. I attached a slightly modified version of Unity's platformer controller script to my player character sprite and left it as a regular box collider at first, everything worked fine. The collisions didn't look normal (since the collider wasn't lined up with the character's legs) so I changed the collider to a polygon and added several points to make the collisions look normal. When I tested the game again, whenever I try to move left or right, the controller no longer works. I can still jump with spacebar for some reason, but movement controls break.

Any ideas on what is causing this? Anyone know how I can use a polygon collider without breaking the character controller?
Title: Re: Polygon Collider - Problems with Character Controller
Post by: unikronsoftware on July 13, 2012, 11:16:55 pm
Polygon colldiers by default won't collide with other polygon colliders, unless marked as convex - perhaps that is the issue you're noticing? For a platformer, you might be able to do a lot better using plain old raycasts to sit the player on the ground. Really depends on the kind of game, etc.
Title: Re: Polygon Collider - Problems with Character Controller
Post by: murkantilism on July 14, 2012, 01:29:05 am
Oh shucks, I can't believe forgetting one check mark caused all these problems. Marking the collider as convex fixed my problem, thank you very much!