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));
}
时间: 2024-10-29 22:06:10

Find a point on a "line" between two Vector3的相关文章

Three.js typescript definitely typed 文件

最近学习three.js,想用typescript编写代码,去http://definitelytyped.org/找了一圈没有发现three.js的definitely typed文件. 好吧,花了2天时间自己简单写了一份: declare module THREE { export class BoxHelper extends Line { constructor(object: Object3D); public update(object: Object3D); } export cl

unity3D:游戏分解之曲线

一提到曲线,很多新手就头疼了,包括我.查了很多资料,终于有个大概的了解.想深入了解曲线原理的,推荐一个链接http://www.cnblogs.com/jay-dong/archive/2012/09/26/2704188.html 之前写了一篇博文<unity3D:游戏分解之角色移动和相机跟随>,里面用到了曲线插值,这里算是对上篇博文的一个补充 先看一下曲线的效果 在使用NGUI的过程中,发现iTween.cs里面有两个很有用的方法,一个是输入指定路点数组,一个就是曲线的插值算法.今天我们主

Unity 绘制Mesh线条

using UnityEngine; using System.Collections; using System.Collections.Generic;   public struct SegmentPoint { public Vector3 normal; public Vector3 pos; };   public class DrawMesh_Plane : MonoBehaviour {   MeshFilter meshFilter; /// <summary> /// 面片

R:incomplete final line found by readTableHeader on

报错: In read.table("abc.txt", header = T) :  incomplete final line found by readTableHeader on 'abc.txt' 解决方法: 在数据文件abc.txt最后一行加上回车即可解决.

windows git安装后更换the line ending conversions

Is there a file or menu that will let me change the settings on how to deal with line endings? There are 3 options: Checkout Windows-style, commit Unix-style line endings Git will convert LF to CRLF when checking out text files. When committing text

hdu 5691 Sitting in Line

传送门 Sitting in Line Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 293    Accepted Submission(s): 143 Problem Description 度度熊是他同时代中最伟大的数学家,一切数字都要听命于他.现在,又到了度度熊和他的数字仆人们玩排排坐游戏的时候了.游戏的规则十分简单,参与

error: bad top line in state file /var/lib/logrotate.status 解决方法

发现日志切割并没有按计划执行,后来手动强制执行时,发现如下报错: [[email protected] logrotate.d]# logrotate -f httpd error: bad top line in state file /var/lib/logrotate.status [[email protected] logrotate.d]# 解决访求: 删除/var/lib/logrotate.status 这个文件即可解决. 解决后,最好再运行一下logrotate -f /etc

OpenCV Tutorials &mdash;&mdash; Hough Line Transform

霍夫直线变换 -- 用于检测图像中的直线 利用图像空间和Hough参数空间的点--直线对偶性,把图像空间中的检测问题转换到参数空间,通过在参数空间进行简单的累加统计,然后在Hough参数空间中寻找累加器峰值的方法检测直线 Standard and Probabilistic Hough Line Transform OpenCV implements two kind of Hough Line Transforms: The Standard Hough Transform It consis

uva 12657 - Boxes in a Line(AC和TLE的区别,为什么说STL慢..)

用STL中的list写的,TLE #include<cstdio> #include<iostream> #include<cstring> #include<list> #include<algorithm> using namespace std; list<int> l; list<int>::iterator it1,it2,it3,it4,it5,it; void work(int a,int a1=1,int