- Home /
How to find coordinate
Hello guys,
I need a solution but i really dont know how to explain. I drew what i want to ask. So, I need the coordinate on question mark. And i need it in 3d. How can i calculate that coortinate Vector3?
Answer by Captain_Pineapple · Jan 26 at 09:06 AM
If you have issues with these kind of questions i can only recommend to try solving some basic trigonometry and linear algebra math questions. This will help you get an understanding for this.
Either way:
you first want to get the vector A which connects P1 and P2 which is A = P1 - P2
Then you want to set the length of this vector to one. This process is called normalization where you divide all entries of a vector by it's total length. In unity you can do var A_normalized = A1.normalized;
Now the point you are looking for is
var target = P1 + A_normalized*L;
Or if you want to do that in one line:
var target = P1 + (P1 - P2).normalized * L;
Please try to understand what is happening here and do not blindly copy the code.
Your answer
Follow this Question
Related Questions
Get RaycastHit Local Coords (C#) 1 Answer
Vector2 Normalize ? 3 Answers
Vector2 vs Vector3 performance? 2 Answers
Rotate Local Space Vector to World Space with heading vector 0 Answers