Collision Detection

Collision detection is necessary for simulating an accurate physics environment. Examples of common usage include prevention of objects from falling through a platform, prevention of objects from passing through each other, and prevention of anything passing outside of boundaries.

To accomplish collision detection without a sophisticated engine, games and software can utilize plane canvases with either an (x,y) or an (x,y,z) coordinate system, whether the game is two-dimensional or three-dimensional, respectively. Thus all objects have a cubic region with coordinates at every corner. So whenever the object moves, the program checks that the object’s region doesn’t intersect any other region, and if it does, then the program moves the object to the nearest sufficient open space.

For more sophisticated collision detection, object velocity, direction, acceleration, and mass must be taken into effect to be able to calculate where the object will move to after colliding, how fast it will move after, and which direction it would move in.

Advertisements
%d bloggers like this: