Checking whether an object is within a 'shape'

Hi there, I have some basic code which tracks the player’s input and stores an array of points. Taken from another post in Unity Answers, I then perform a few checks to determine whether it’s ‘close’ in shape to a circle (at least nearly a closed loop):

  • I check how far the first point is from the last;
  • I check that there are a minimum of 4 points;
  • From all the points stored, I calculate the average of their x and y positions/number of points to generate a ‘centre’ point.

All is well, this seems to do the trick. However, what I need to achieve next is to ascertain whether an object is ‘within’ the shape the player has drawn (remembering that it could be a non uniform shape, so I can’t rely on a consistent radius). So in the attached pic, you can see the points, the centre point and an object.

Could anyone point me in the right direction? With a circle it’d be easy, but this is a little more tricky…

Perhaps I don’t understand the question, but couldn’t this do what you want?

Just use your shape points to define the poly.