Archived

This topic is now archived and is closed to further replies.

DVazanias

How to implement Collision Detection?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites