• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

 Feature Suggestion/Request - Point of Collision


In searching the forums on how to determine the point of collision with an instance, there have been numerous work-arounds suggested, such as binary search algorithms, usage of a collision_line for estimation, etc. I'm not at all familiar with the backend of what goes on during a collision detection, but it seems that since a collision has been detected, GameMaker would be able to provide where that collision took place (x,y).

Note, this is not the x,y coordinates of the instance, but instead, the x,y coordinates of where the collision occurred with the instance.

Is this possible? Would this be beneficial to others besides myself?


it's not possible (most of the time).

When collisions occur, rarely is there a single point of contact. Instead you have multiple points of contact and overlap.


If multiple points are involved at the area of collision, then return the average of the x and y coordinates and return that point. At least, that would be the center of the collision (or close).

If that's too much, I'd be happy with returning the first point of collision, in the event of multiple points. In most cases that I've run into already, that would be "good enough" and prevent the implementation of some of the other techniques that are complex and CPU expensive.


After thinking a bit more on this, simply add a function to colision_line, which has a single point width and return the point where the line meets the edge of the colliding instance. That would be a great solution.