projection of a point on a line

i need to project a point on a line.
i have two waypoint positions w0 and w1 , and a point P.
I have tried.

projectedPoint = Vector3.Project( (P-w0), (w1-w0))

But Debug.DrawLine(projectedPoint, P); does not intersect the line (w1-w0)

Since Vector3.Project(); doe not show any example, I am confused how to use it.

Please help.

Your code seems almost right: you’re creating a vector w0->P and projecting it on w0->w1, but the result will be a vector based on 0,0,0. Add w0 to the result and you should obtain a point in the line:

projectedPoint = Vector3.Project((P-w0),(w1-w0))+w0;