Find a point on a 'line' between two Vector3

Find a point on a 'line' between two Vector3
http://forum.unity3d.com/threads/find-a-point-on-a-line-between-two-vector3.140700/

public Vector3 LerpByDistance(Vector3 A, Vector3 B, float x)
{
    Vector3 P = x * Vector3.Normalize(B - A) + A;
    return P;
}

Tips: x can more than the distance between A and B

Vector3 Lerp(Vector3 start, Vector3 end, float percent)
{
    return (start + percent*(end - start));
}

 

posted @ 2016-04-07 11:53  elfnaga  阅读(183)  评论(0编辑  收藏  举报