1
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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

\$\endgroup\$
2
  • \$\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
    Mar 13 '18 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
    Mar 13 '18 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.