GLBasic forum

Main forum => GLBasic - en => Topic started by: jestermon on 2012-Sep-16

Title: Ray collision coordinates
Post by: jestermon on 2012-Sep-16
I am looking at finding the actual world coordinates for a ray collision against an object in order to apply "bullet holes" to walls and other surfaces.
Since in low level OpenGL, one  uses Dot Product Between Plane Normal And Ray Direction to determine collisions - is it possible to do this type of low level of detection in GLBasic?

Edit: After some thought, I think I don't need to go to polygon level. I've not yet done a test program, but I think the following solution may be quick and easy and do just what I need.
1.. Get collision ray distance: If positive.
2.. Extend the direction vector to the length of the ray, and derive the collision coordinates.

Now with the coordinates available based on the vector length, the next question arises: How do I get the surface normal at point of collision? Is this possible at a high level?
Title: Re: Ray collision coordinates
Post by: kanonet on 2012-Sep-16
I think X_GETFACE should be a strong hind how to solve your problem. ;)
Title: Re: Ray collision coordinates
Post by: jestermon on 2012-Sep-16
Aha. Yes, I see it now. Thanks kanonet, X_GETFACE is just what I need.
Still being new to GLB, I have a lot of functions to go through, and the solutions are still not so obvious. But once one sees them, the light switches on.