Jump to content
  • Advertisement
Sign in to follow this  
KxL

[SOLVED] heading vector problem

This topic is 4284 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, its hard to describe my problem without a image, so please take a look at this: http://www.users.pjwstk.edu.pl/~s2562/problem.jpg P,P1, and O are points in 3d, but they all are in one plane (for all of them Y value are 0), so we could think about them as 2d points. V is a vector (same as points, showing 2d direction). My aim is to find angle by which I have to rotate heading vector to aim at P1 point. Rotation orgin is O. Is it possible to do it with this 4 parameters (P,O,P1,V)? If I knew P` or V` i could count angle. Thanks for any help. Krystian [Edited by - KxL on January 26, 2007 2:47:52 PM]

Share this post


Link to post
Share on other sites
Advertisement
you know alpha, which the angle between vector |OP| and V.
you know |OP'| (the radius of turn).
you know |OP1|.

Share this post


Link to post
Share on other sites
I was going to suggest that you find the intersection of the direction ray with a circle centered at O with radius |OP1|. Call that point Q. Then the rotation is just the angle between OQ and OP1. You can determine angle and rotation direction with a dot/cross product pair.

I too made a pretty picture (just modified your original one):

Share this post


Link to post
Share on other sites
Thank you all!

Zipster, your solution is greate. I do my own calculations, and my solution was:
http://www.users.pjwstk.edu.pl/~s2562/odp.jpg

as you can see, I haven't notice, that my angle is QOP1, and draw another circle, and do circle-cirlce intersection to find P' Your solution is much more clever.

Best regards,
Krystian

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!