0
$\begingroup$

Hi I am wondering how best to explain this, I am working with WebGL (effectively OpenGL) and I have the ray cast from clicking in 3d space. I have the far and near values of the ray cast, the camera position and the target it is looking at.

How do I work out where the ray cast starts and ends, effectively to draw a line to show the ray cast through 3d space. The most confusing part of this for me is the angles, subtracting the angles of the cameras face which are also in radians.

Camera position would obviously be the start point, so I need to use that and using the direction the camera is facing, along with the near and far values of the ray to get the end point! I'm confused, please help.

$\endgroup$
1
  • $\begingroup$ How are the angles that the camera is facing given? Then are the near and far values the distance from the camera? Do you have the camera location in 3D space, or is it take to be the origin? $\endgroup$ – Ross Millikan Dec 30 '10 at 15:40
0
$\begingroup$

Solved: I obtained the correct values from else where within the WebGL wrapper.

$\endgroup$
2
  • $\begingroup$ Please accept your answer so the robot doesn't keep bringing this up. To do so, check the gray check mark. Thanks $\endgroup$ – Ross Millikan Dec 30 '10 at 19:23
  • $\begingroup$ sorry it said I had to wait a long time to accept my own answer, I ended up forgetting about the post. $\endgroup$ – Chris Jan 10 '11 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.