Godot Version
4.3
Question
I am currently making a racing track generator in godot. To put it simply, I create randomly generated racetracks. I plan to use RL Agents to make an IA drive around these tracks. The problem is that I need my race car to detect if it is on the track or not. I used _draw() for the visuals, but wasn’t able to find a collision detection method for _draw(). So, using my track info, I was able to make a Line2D that perfectly followed the shape of my racetrack. But, here again, the same problem arises: How do I detect if the car is inside my Line2D (either partly or fully).
In a few words : Detect if CollisionObject2D is inside a Line2D.
Thanks in advance.
(P.S: I am not a native English speaker, so please pardon any spelling mistakes.)