To keep things slightly short and simple... (Two things I am good at. ::) )
In the "Entity World" of TBGL, as opposed to the RAW GL-View. For the "Informational" or as part of the "Collision Detection" area...
I would like to request what I believe is the most basic, (Not simple, just basic.), collision detection item which we would need to process our own collision detection code. (Well, our own code based on the rendered output of the view or the entire "Entity" world.)
{Ray Intersect Distance}, which would be used to check if there is something in the world/view that this "Ray" intersects with.
For example, we would input...
- {XYZ Start} (And)...
- [{XYZ Point} Or {XZ Angle, Y Angle}] (And)...
- {Unit Distance}
That would be used to find anything in the entity-world, along that "Ray", which intersects the ray within that distance. The return value, to be of any use to us, would have to include the distance of the intersection along the ray, or the XYZ location of the intersection, and also the entity/item which the point intersects.
Repeated empty calls would recycle the same values, but ignore the prior entity/item detections.
EG...
If I am a boat, floating on a fixed-horizon, and I want to check collision/intersection with a "Ray" dropped from the front of the boat...
TBGL_RayHit(MyNoseXYZ, DownOnAxisY, BoatDepth, %IntersectDistance)
Returns (IntersectDistance, EntityID)
I see that the distance is not -1, so there is an object present, the object is the WATER, so I call again...
TBGL_RayHit()
Returns (IntersectDistance, EntityID)
I see that this is not -1, but this is a decoration fish, ignore it, and call again (Or kill the fish)
TBGL_RayHit()
Returns (IntersectDistance, EntityID)
I see that this is not -1, and this is a rock... (Stop the boat, a collision is about to happen.)
However... If...
TBGL_RayHit()
Returns (IntersectDistance, EntityID)
If this returns -1, the distance that was set to cast the ray has not produced any more collisions.
These things can not be done by our code, because we don't know the "Space" in which the entity is being drawn, and this would require the GL items to be duplicated in arrays, being calculated side-by-side to match the output/translations of the entity world, for us to calculate. This would also require us to all use the M15 format exactly as you use it, and track which entities are on and off in the world. (Without the speed gains of the GL matrix translations.)
But, if that single item can be translated for us, from the GL world... We can respond to the scenery without duplicating the world through a view-port/rendering that adds undesired overhead, and can provide false and limited information, as undesired elements pass between the camera and the desired target.
Point Inside does not help unless you know where the surface is. It can only help do entity/entity detection of small bodies. (Thinking about the race-track ground surface, and rooms, which we will always be inside.)
For reference, though not the best code for collision... (It is better than a lot of the half-code I see all over.)
http://nehe.gamedev.net/data/lessons....asp?lesson=30