Search code examples
objective-ciphonegeometrycollision-detection

Help with Triangle collision detection in Obj-C


I haven't taken any advanced math courses or anything (I'm still in high school) and I just don't really understand all the triangle collision systems online.

I have two triangular objects in a 2D space. How should I write Obj-C code so that a collision/intersection between the two can be detected? I'm stumped.


Solution

  • Perhaps one of these techniques will help:

    http://www.blackpawn.com/texts/pointinpoly/default.html

    Basically, to simplify things you could start by just trying to figure out if each of the three points of a triangle is inside the other one - since having a corner from one or the other enter the other one is the only way they can be overlapping.