• Advertisement

Archived

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

ray problem

This topic is 6013 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
Do you need to calculate euler angles? If you don''t, you can just make a look-at matrix and multiply the ray by it.

Share this post


Link to post
Share on other sites
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