I'm working on a 3d kindof game where I'll eventually be able to modify the shapes present in the environment by pulling their faces with a crosshair. The thing is that I don't know how to achieve ray-quads or ray-triangle collision. I did it once with a teacher at school, but he didn't have much time and it was not well constructed (+I lost this code). I was also wondering how I could check for theses collisions with thousands of shapes? Because I know this is quite resource-demanding and doing this for 1000 spheres/cube/freeform shapes is not easy. If anyone could help me push my knowledge a bit further, it'd be very much appreciated!
I also work in Java using LWJGL, so OpenGl.