Search code examples
pythonopenglpyopengl

pyopengl - Is there a way how to get intersection of line and quad/triangle?


I would like to find out if there is clear visibility between point A and B (no obstacle in the way). Is there a function that do exactly that?

Alternatively, a function in pyopengl that can find intersection of line and quad/triangle could work as well. Preferably if I can provide list of quads/triangles to the function.

Any ideas?


Solution

  • In short, this is something that OpenGL isn't really going to help you with, and is more a job you are going to have to deal with. The easiest way is to use a physics engine like Bullet3D, where you would wrap all your objects in bounding boxes and intersect a ray from A to B with the scene to check if anything obstructs it.