Download

Collision for a Spline

In my project I need to do collision tests against my spline, with a specified radius.

What I am doing is using nested for loops to test along the spline at a specified internal, and then test along the line with a specified interval. If a location on the line is within the radius to the location on the spline, then that counts as a hit. However, in order to make the hit detection work consistently, the interval has to be small enough that it causes unsatisfactory performance.

My next try was using a procedural mesh to create a collision mesh for my splines, but because it has to be updated every frame, the performance is even worse.

Does anyone have any ideas on other methods I could try?

Maybe some more clever math?