How to implement Collision Detection?

Started by
1 comment, last by DVazanias 21 years, 7 months ago
I am aiming to set up a virtual grid of sections over my world so that i can cut down on the number of objects checked during collision detection. Therefore i only have to check the objects in the same section as the player''s object. However i am struggling with the code to set this up. I tried making a cSection class and a cGrid class. Each section keeps a list of all objects inside it and the grid keeps track of the positions of all the sections So there is a list of sections in the grid and a list of objects in each section. First of all does that sound like a goo way of implementing it? Second how do i get the objects to tell the sections which section it should be in? Thirdly the reason for doing it this way is so that i don''t have to loop through every object to check which section it is in and that i only have to look at the section data - i don''t think i am managing this though Please could someone provide me with a code sample on how to do this. I am struggling. Also is using a vector a good way of doing a linked list for this kind of thing? (e.g. tracking th objects in a section is done through a vectorObjList
Advertisement
PLEASE IGNORE THIS THREAD I POSTED ANOTHER EXACTLY THE SAME BECAUSE MY NETWORK WENT DOWN ASI POSTED IT AND I DIDN''T THINK IT WENT THROUGH...IF YOU HAVE A REPLY PLEASE POST IT IN THE OTHER THREAD ABOVE THIS ONE - SOZ
how about deleting it? please learn to use the editfunctions of the forum..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

This topic is closed to new replies.

Advertisement