I have a player character that has three separate coliders that form this shape (one for the top, one for the bottom, and one for both sides) enter image description here

I'm trying to register floor collisions with the bottom collider so that I can reset jumping stuff (double jumps, etc), but since the corners are all touching the floor, I end up having the side colliders enter as well when I use OnCollisionEnter2D().

Is there a way to get which colliders are contacting, or is there a better way to register these collisions?


How about using a single rectangle only? Calculate the distance to the other colliding asset.

The smaller component will tell you the axis, the sign of that component the direction.

For example a positive x could indicate a collision on the right, while a negative value wouldn't indicate a collision from the left.


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.