Find a third point, knowing two position vectors

Started by
7 comments, last by Durden78 7 years, 3 months ago

Hi guys,

my vector math is a bit limited and rusty, and I encountered this problem I need to solve.

2GaNJBA.png

I have two different objects in the game world, their positions being V1 and V2. I need to find the position V3, knowing only V1, V2 and of course their distance.

The solution should work for arbitrarily oriented objects (in the picture, example A is axis-aligned, while B and C are not).

V1 and V2 will always be parallel, but they could have inverse directions (example C in the picture above).


Thanks in advance!

Advertisement

Treat the velocity/direction of V2 as a line, and the location of V1 as a point. You then want to project the point V1 onto the direction line of V2. https://en.wikipedia.org/wiki/Vector_projection

Yeah, I looked into projection, but I don't know how to "treat direction of V2 as a line". I just have the position of an object in V2.

The arrow on your diagram (orientation, or direction of travel?) is the line you need.

Yep, it's an orientation. Can I use the "forward direction" of the object in V2 for this purpose?

Yes, if that is what is represented by the small black arrow in your diagram.

Yes, it's the (normalized) forward direction of the object in V2.

If I project point V1 on the "forward" of V2, what do I get? Red or Blue in the following picture?

bqhANEE.png

You get red. Remember that the direction of V2 is expressed as a relative value. As such, that direction represents an infinite line that passes through V2 and the arrow you've drawn (and the dotted line in your previous examples), and it's that which is projected onto. The position of V2 is not a value that even enters into the equation.

Got it! Thank you very much for your help.

This topic is closed to new replies.

Advertisement