PDA

View Full Version : Collision Detection



shalin
02-18-2001, 02:05 AM
hi,
i need help with collision detection.
I am flying a model(say a quad for simplicity) through a terrain. The terrain is loaded from a 3ds. So i have huge arrays of vertices, normals and texture co-ords which are then loaded into display lists.
How do i detect collision??
Is there some way to implement Ray Picking?
If someone could give me example code rather than a theoritical explanation, nothing like it!
Thanks a lot

Michael Steinberg
02-18-2001, 04:14 AM
If you have a raster on the terrain, you know on which polys you've got to do the ray test, regarding your current position. Otherwise I would create such a raster through octrees or even quadtrees.

shalin
02-18-2001, 07:52 AM
Raster? You mean something like fingidng out which polygon a pixel on the screen belongs to and then interpreting whether that polygon should be there in a non-collision/collision condition?
How should i do something like that?

Michael Steinberg
02-18-2001, 10:19 AM
No. I mean, a raster of heights, ie: a height map with which you built the mesh of your terrain. It would look like normal quads from above (a grid or raster). You would exactly know which triangles to test with given a certain position, since they're used in a regular manner. Same applies to octrees. From the position you can calculate in which box you are and only test with the faces that are in that box. I've simplified it a bit, but it is basically the way to go.