I rendered a Line in the worldspace and would like to make the player follow the line using touch input. Then I want to check how accurate the player is. Is there a way to make raycasting on the line? The line renderer has a bounding box, but the box size is the size that covers the whole line set, I need a point precision on the collision check. Can anyone help on this? Any suggestion to implement this?
Instead the line renderer use raycast in your scripts, then use the line renderer with the same coordenates of raycast just to show the line.
A simple point-line distance check may work better than collision detection in this case.
A pseudo-code example:
if DistanceFromPlayerToLine < Tolerance // Player is following line correctly. else // Player has strayed too far from the line.
I don't have any references for 3D distance equations handy.
If your game is 2D:
Here is a good reference for 2D point-line distance.
For C# code, you can search the code in this google code project for "GetPointSegmentDistanceSq" or "GetPointLineDistanceSq".