Hello Guest

Author Topic: Polygon Collider - Problems with Character Controller [SOLVED]  (Read 5193 times)

murkantilism

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
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?
« Last Edit: July 14, 2012, 01:31:28 am by murkantilism »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Polygon Collider - Problems with Character Controller
« Reply #1 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.

murkantilism

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Polygon Collider - Problems with Character Controller
« Reply #2 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!