PDA

View Full Version : Need help understanding collision detection between Object and Ground ........ !@!



jubei_GL
07-08-2002, 09:01 AM
I would like to know how can I detect "collision" when Object (like CAR) drives on the ground.. You know wheels always touch the ground etc .. First I thought I would just get the hight of the Vertex on which the Wheel is located.. But how would I know where to look for this Vertex info in the array ( 1D or 2D ) ??? I think if I were using 2D ARRAY, I would just use the Wheels (X,Z) values, to specify the location (row, column) in 2D array where Vertex hight for this particular location is stored .. Is this how it is done ???? ( I assume that my ground lies in positive X,Z quadrant ) ...

Is this the way it is done to detect the distance between an Object and the ground ? Or there is more efficient way ???

Also in 3D racing games, I understand that Race Tracks for example are made using 3D programs such as 3Dmax .. So if you LOAD this track ( buildings, road, trees, barriers etc ) into the memory as a whole, how will you know which part of this track data to use for collision, or computing the position of the Car on the Track, ( so when the car goes off the Track, you should hange to off road conditions etc ) ....

Anyone can TRY to explain that to me ? LOL> thx in advance

dabeav
07-08-2002, 09:47 AM
Ok, this is a VERY hard subject. Fast Effiecent Collition detection is not very easy to do, but here is a small crash course.

This is how my collision detection is implemented, changed just a bit to work with cars and a track.

The track is simply a series of triangles, each triangle in that series, has a normal vector. (which tells the PC what way is up for lighting). The wheels of the car are in effect spheres, with 2 sides cut off. You can very quickly find the distance between the sphere and the normal "plane" with a dot product of the sphere center and the plane normal - the spheres radius. With this you can tell if you are touching the plane or if you have gone through the plane, or if you are not touching it at all. (with some math ofcourse) However, this only tells you if you have hit the "plane that the Triangle lies on, you must then check to see if you have actualy hit the triangle, this can be done in a number of ways.

I could go on, and on, and on, (you get the point) go here instead, it is what got me started in the lovely world of Collision Detection.
http://www.cfxweb.net/~cfxamir/tutorials.html