Circular line collision?


As this is my first posting lets point out how great GDevelop is :slight_smile:

So a short question:

I am drawing a circle with Shape Painter, as I see its not possible to create collision events with drawn shape painters.
However, what is my alternative?
Could someone explain me how to create a circlular hitbox, where the inner circle is not part of the collision?

Background: i want to create a game where I follow the lines of a circle, and you only get points when following this line - so inside the circle = no points, outside the circle = no points, on the line = point.

Greetings :slight_smile:

To check if the point P is in the line of width W around the circle of center O and radius R, you should check if the point P is outside the inner circle of radius R and inside the outer circle of radius R+W, both of center O.
Better, check if the distance between P and O is greater than R and lesser than R+W:

R < ||(P - O)|| < R+W

In GDevelop, you’ll have the X and Y coordinates as separate variables, with P, for example, as the mouse position, and O as the center point of the object Circle, in GDevelop:

Conditions: No conditions Actions: Do = sqrt( pow(Circle.PointX(Centre)-MouseX(), 2) + pow(Circle.PointY(Centre)-MouseY(), 2) ) to variable Distance // Sub-events Conditions: Variable Distance is >= R // Maybe R = Circle.Width()/2 Variable Distance is <= R+W Actions: //(MouseX(); MouseY()) is in the circle outerline