Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE30138A55A@probe-2.acclaim-euro.net> From: Shawn Hargreaves To: djgpp AT delorie DOT com, agp AT mail DOT canvaslink DOT com Subject: Re: Another 3D Question Date: Tue, 11 May 1999 14:41:09 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1460.8) Content-Type: text/plain Reply-To: djgpp AT delorie DOT com Carlos Giani_AEN2003 (M2003) writes: > How does collision detection in 3D work? For object to object collisions, use bounding shapes. A sphere is the simplest (just check the distance between the centre of your objects), but for more complex shapes you might want to deal with ellipsoids or box shapes. Checking these things for intersection is just a little matter of mathematics (read: tricky to work out, but can be done: see the comp.graphics.algorithms FAQ for some relevant formulas). If you are talking about collision with an environment, you need to check whether a vector (from where a point was to where it has moved) has passed through any of the polygons in your mesh. Again, that is just mathematics: calculate the intersection of the vector with the plane defined by the polygon, then check whether this point actually lies inside the region of the plane that is covered by the poly (you can flatten the whole thing out into 2d for doing these tests, discarding whichever axis has the smallest gradient). In terms of doing it fast, the important thing is to cut out as many polys as possible without having to test them at all. Sector partitioning systems can work well, and a BSP tree format even better, but it is really tricky to convert an arbitrary mesh into a well balanced BSP. Shawn Hargreaves.