|
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?
(comments are locked)
|
|
A simple point-line distance check may work better than collision detection in this case. A pseudo-code example:
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".
(comments are locked)
|
|
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.
(comments are locked)
|
