You can use Vector2.Distance() to compute the distance between any two points.

In your case compare each end of the line to each place it’s supposed to be.

When both are “close enough” (whatever that means in your case), off you go.

Here’s why you must use “close enough” rather than “exactly”:

Floating (float) point imprecision:

Never test floating point (float) quantities for equality / inequality. Here’s why:

https://starmanta.gitbooks.io/unitytipsredux/content/floating-point.html

“Think of [floating point] as JPEG of numbers.” - orionsyndrome on the Unity3D Forums

2 Likes