I am trying to create a 3 maze, which you can walk around, and I have no idea how to use collision detection when it comes to the individual walls. I have one method for a wall, and I am constantly calling it and rotating it as necessary for all the interior walls. The walls are simple polygons written using GL_QUADS… any help would be much appreciated.
Hope this gives you an idea, let me know if you need more detail.
Originally posted by Music_Man:
[b]I am trying to create a 3 maze, which you can walk around, and I have no idea how to use collision detection when it comes to the individual walls. I have one method for a wall, and I am constantly calling it and rotating it as necessary for all the interior walls. The walls are simple polygons written using GL_QUADS… any help would be much appreciated.
Thanks for your reply, but unfortunately, I dont think it will work. My maze is 1000x1000, and with the walls being simple polygons, their thickness is 1, so I would need an array 1000 by 1000…
Still the same why, each cell could have a width of 10. Which would give you 100 x 100 array.
The best way is to have a map, you need to know anyway where to draw the walls. That same data is your map.
I dont have time go into detail, but you could have only wall position in data arrays. which if you had only a limited amount of walls to do would work else the map idea it just as good.
Every time you move check the array for the object getting close to a wall. Just a simple vector distance check to see how close you are to a wall.
Originally posted by Music_Man:
[b]Thanks for your reply, but unfortunately, I dont think it will work. My maze is 1000x1000, and with the walls being simple polygons, their thickness is 1, so I would need an array 1000 by 1000…
How I do it at the moment, is just call the draw method repeatedly to draw each wall… no matricies of anything of the such… sorry if this makes no sense… just got in… its 2:26am, and I am drunk…
The simplest way to do it is to check the distance to each wall. If it is less than a certain value, you have collided. To speed it up, you can put the walls into groups and only check the walls in the groups that you are close to. Three ways to group the walls - BSP trees, octrees/quadtrees, cells.