I am working on a Cocos2D project using Box2D and I am trying to detect when 2 specific edges on an object touch, for example for the red edges in the images below:
I am still learning collisions but I understand the basics and how to detect if 2 specific bodies touch, but I cannot figure out how to detect specific edges.
One solution I thought of was to new create bodies on the edges that I want to detect, but I want to know when both red edges are completely aligned and the boxes form a rectangle.
There may be an easy way to do this but I scoured the internet and found no useful examples.
Any help is appreciated, thanks!