Question by
MarcoZan · Dec 07, 2020 at 11:08 AM ·
gameobjectdistancecalculate
Calculate distance between gameobject and polyline
Hi Everyone,
i am a beginner and i am using unity to make a driving simulator and i would like to calculate the distance (while driving) between the vehicle and the center line of the road, then the distance between the vehicle gameobject and a polyline that i entered.
I tried using HandleUtility.DistancePointLine, public static float DistancePointLine (Vector3 point, Vector3 lineStart, Vector3 lineEnd).
But with this method the distance between a point and a line is calculated, while I would like to have it between a gameobject and a polyline, and above all in a dynamic and not static way.
Do you have any suggestions?
Thanks
1.jpg
(30.1 kB)
Comment