Checking for a point within a 2D shape (v3.5)

When i was working on a similar problem, i calculated the midpoint for each shape, then going through each of the vertices i find the maximum distance from the mid point. This way i can use a radius check using the mouse and the midpoint. If the test passes then i can test the point shape collision. If not move on and test another shapes radius. The midPoint only needs to be calculated once, providing your vertices arent changing, and if the shape is translated then you would update the midpoint based on dx and dy.

1 Like