public bool GetNearstPoint(Vector3 pt, ref Vector3 tp)
{
bool ret = false;
if (null != m_Path && m_PathStart >= 0 && m_PathStart + m_PathLength >= 1 && m_PathStart + m_PathLength <= m_Path.Count) {
if (m_Path.Count > 0) {
float dist = Geometry.PointToPolylineDistance(pt, m_Path, m_PathStart, m_PathLength, ref tp);
float r = Geometry.Relation(pt, m_StartPos, m_Path[0]);
if (r >= 0 && r <= 1) {
Vector3 t = Geometry.Perpendicular(pt, m_StartPos, m_Path[0]);
if (Geometry.DistanceSquare(pt, t) < dist * dist)
tp = t;
ret = true;
} else if (dist < 1000) {
ret = true;
}
}
}
return ret;
}