How can I check it if a line3D/ or ray is intersecting a sphere?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
The real time rendering web-site is good source for different intersection algorithms (including ray/sphere intersection): |
|||
|
|
|
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. |
|||
|
|
|
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. |
|||
|
|