How would I go about detecting the corners of a texture when I use pixel collision detection? I read about corner collision with rectangles, but I am unsure how to adapt it to my situation.

Right now my map is tile based and I do rectangular collision until the player is intersecting with a blocked tile, then I switch to pixel collision.

The effect I would like to achieve is when the player hits the corner of an object to push him around the side so he doesn't just hit the edge and stop.

Any ideas?


You should check several pixels ahead your sprite.

A exhaustive article about it (in Sonic games) is located here: http://info.sonicretro.org/Sonic_Physics_Guide?v=0

  • \$\begingroup\$ Checking the pixels ahead a bit to see if it transparent worked. I'm embarrassed I didn't think of something so obvious. Thank you :p \$\endgroup\$ – Milkboat Apr 11 '12 at 22:03

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.