• ### What is your GameDev Story?

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

## 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 on other sites
It should be possible.

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

##### 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.

##### Share on other sites
that's better actually :) It can be done with vector maths.

##### 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

• ### What is your GameDev Story?

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

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015825
×