I have a 2d player who can only walk on black area. There is a red collider so player can't walk past it.

Player has capsule collider.

The problem is player can't walk toward the edge with his feets becasue of the it's collider. But player would probably want to walk toward the edge.

Here is a sketch I've made.

Is there a way to tweak this ?

enter image description here


1 Answer 1


Make the capsule collider on his feet and not on his whole body. So he could walk all the way to the ledge.

enter image description here

  • \$\begingroup\$ Hey that could work. But I would like enemy could hit player in the range of head. Can I set different hit collider for the body and head ? How would then I set that head collider does not collide with area collider ? \$\endgroup\$
    – Wildfire
    Commented Mar 13, 2018 at 15:45
  • 2
    \$\begingroup\$ Yea you could. Its common it games to have multiple hitboxes. Then you can make logic for each collider. For movement use feet collider for damage use the body/head collider. You could also have logic for doing damage to the feet. \$\endgroup\$
    – lambparade
    Commented Mar 13, 2018 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .