Calculate the intersection depth between a rectangle and a right triangle
Posted
by
Celarix
on Game Development
See other posts from Game Development
or by Celarix
Published on 2012-09-21T03:02:20Z
Indexed on
2012/09/21
3:51 UTC
Read the original article
Hit count: 271
XNA
|collision-detection
all. I'm working on a 2D platformer built in C#/XNA, and I'm having a lot of problems calculating the intersection depth between a standard rectangle (used for sprites) and a right triangle (used for sloping tiles). Ideally, the rectangle will collide with the solid edges of the triangle, and its bottom-center point will collide with the sloped edge.
I've been fighting with this for a couple of days now, and I can't make sense of it. So far, the method detects intersections (somewhat), but it reports wildly wrong depths. How does one properly calculate the depth? Is there something I'm missing?
Thanks!
© Game Development or respective owner