简体   繁体   中英

How to find a point X between two Vector3 in Unity3d

OK, it's not easy explain me so i will use an image.

I have the following problem :

I have a line between two points A and B. I need to calculate the coordinates of the 'X' point knowing that it is perpendicular to the point C.

编辑情况

Unity has a built-in function for this : Vector3.Project

Vector3 AB = B - A ;
Vector3 AC = C - A ;
Vector3 AX = Vector3.Project(AC, AB);
Vector3 X = AX + A ; //How say Lutzl works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM