Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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