码迷,mamicode.com
首页 > 其他好文 > 详细

Find a point on a "line" between two Vector3

时间:2016-04-07 12:04:56      阅读:196      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!