Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I check it if a line3D/ or ray is intersecting a sphere?

share|improve this question

The real time rendering web-site is good source for different intersection algorithms (including ray/sphere intersection):

share|improve this answer
Except that a ton of the links are down these days. – Dudeson May 8 '15 at 0:56

The problem logically reduces to finding the shortest distance between the ray (line) and the sphere centre. If that distance is shorter than the sphere radius, there is an intersection.

Of course, there's a formula for line-point distance.

share|improve this answer

It is a part of ray tracer design. Look at the ray and sphere intersection. It is very simple and commonly used in every ray tracer.

share|improve this answer
You could have added a link or something at least. – Dudeson May 8 '15 at 0:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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