 ## Mathematical Collision Detection Calculating collisions in a software graphing engine:
1. Each object in your simulation is represented by a matrix overlayed on a three dimensional grid, defining the space it occupies with points.
For this example, let us posit that there are two objects on a single landscape, for a total of three objects.
2. Place all the matrices within the three dimensional substrate matrix whereby a translation of each matrix can occur as over the substrate as one cell shifts with its adjacent cells to a new position.
3. Where two matrices overlap, save the location of each overlap and which matrix it came from in the substrate.
4. Since each matrix should have a unique number stored for each vertex (along with any other relevant values in an array) and each vertex is essentially contained in a cell of the matrix, if the matrices overlap, an addition is logged in the substrate telling you which cells were crossed and at what speed, and which region of the matrix collided, et cetera.
5. Define an action to take place after the collision, such as a rebound, a sound effect, or a nullification of one of the matrices, or one of its parts, or any other resulting action you desire.
Rate this post
« Previous: All Bad Things Must Come to an End