Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

IStrikerI

ray problem

This topic is 6188 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

i need to rotate a rays vector so that it points to a certain point. i already know how to rotate a vector by a certain amount of degrees. i thought about calculating a vector from the rays origin and the certain point using vector subtraction and then using the dotproduct to get the angle between this vector and the rays vector. then i rotate the rays vector by this angle. but i saw that this only works in 2D. in 3D i have to rotate the vector by two angles around the X and the Y axis. can somebody help me ?

Share this post


Link to post
Share on other sites
Advertisement
Actually it''s very simple:

you have
- a ray=(origin,direction)
- a point P

just fill in normalized(P-origin) for direction

There''s no need for a rotation

Share this post


Link to post
Share on other sites

  • 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!