Hierarchical Collision Detection

I've read a bit on collision detection just as I've been bored and wanted to understand it a bit better. There was mention about a hierarchy system which will basically cut down on system resources and is invaluable for complex collision detection optimization. All it involves is large collision volumes around objects that need to detect a collision first, before more intense collision detection inside the model is used. There can be a number of hierarchies, but I think 2-3 is probably enough.

EG: Character will have a rectangle around it. When the rectangle detects a collision, it will start the collision detections of the envelopes in the model.

Kudzai's Grid Collision Detection

Hey Loen, since you the one working on collision, this is mainly for you to consider if you'd like to implement or not or develop it if you like but I was sitting on my behind the last hour and this came to mind…

  • it will work on square rooms and building
  • the bounding areas are set according to room borders
  • free roaming of the character is within borders and out of borders with exceptions at some borders based on boolean set points
  • it will mainly affect the character
  • it is also mainly hard-coded but may be made alterable for application when creating many rooms
x1 x2
z2 DoorBound1
z3 DoorBound2


Using the grid above, there may be a room marked with the bounds where x = x1, x = x2, z = z1 and z = z4. Thus we may have the first set of boolean variables to mark these bounds

Boolean xBounds = true when (x > x1) && (x < x2)
Boolean zBounds = true when (z > z1) && (z < z4)

Next, we can place a door where z > z2 and z < z3 and x = x2 thus we have our third boolean

Boolean door1 = true when (z > z2) && (z < z3) && (x = x2)

Now for collision to take place, this will need to be taken account of… collision would occur at a certain range of points which are as follows

  • x = x1 && (door1 = false) && (zBounds = true)
  • x = x2 && (door1 = false) && (zBounds = true)
  • z = z1 && (door1 = false) && (xBounds = true)
  • z = z4 && (door1 = false) && (xBounds = true)

The character thus can enter and leave the room where door1 = true. In place of x and z, the position of the character may be used with the use of inequalities set based on whether the character is in the room or out of the room. Thus there may be the addition of other booleans e.g inRoom1, inRoom2, inHallway, inCorridor, outside etc. These will help set up further collision grids for square and rectangular rooms!! Enjoy

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License