Jump to content
• ### What is your GameDev Story?

• Advertisement

# Find a third point, knowing two position vectors

This topic is 739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi guys,

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

I have two different objects in the game world, their positions being V1 and V2. I need to find the position V3, knowing only V1V2 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!

#### Share this post

##### Share on other sites
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

Edited by Kylotan

#### Share this post

##### Share on other sites

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.

#### Share this post

##### Share on other sites

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

#### Share this post

##### Share on other sites

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

#### Share this post

##### Share on other sites

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

#### Share this post

##### Share on other sites

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?

#### Share this post

##### Share on other sites

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.

#### Share this post

##### Share on other sites

Got it! Thank you very much for your help.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 9
• 33
• 16
• 11
• 10
• Advertisement
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015635
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!