首页 > 其他 > 详细

Find a point on a "line" between two Vector3

时间:2016-04-07 12:03:20      阅读:193      评论:0      收藏:0      [点我收藏+]

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));
}

 

Find a point on a "line" between two Vector3

原文:http://www.cnblogs.com/elfnaga/p/5362893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!