Using Chipmunk's spatial hashing
Posted: Tue Jan 27, 2009 12:04 pm
Hello all,
After giving up on writing my physics system for a 2D platformer, I decided to integrate Chipmunk. Because I'm working in D, this involved the creation of bindings, but it all seems to be working now. My question regards the use of Chipmunk's hashing for things like drawing, hittesting, etc. My project has been using a quadtree class I wrote for object storage, but it seems like an awfully bad idea to maintain two seperate lists of objects, with the quadtree updating constantly to reflect the status of the chipmunk objects. Is there a quick way to return lists of objects within a world region? IE., for my rendering code, I'd like to know what bodies are at least partly contained within a certain rectangle. If such a function doesn't already exist, how can I get access to the bits necessary to write one?
After giving up on writing my physics system for a 2D platformer, I decided to integrate Chipmunk. Because I'm working in D, this involved the creation of bindings, but it all seems to be working now. My question regards the use of Chipmunk's hashing for things like drawing, hittesting, etc. My project has been using a quadtree class I wrote for object storage, but it seems like an awfully bad idea to maintain two seperate lists of objects, with the quadtree updating constantly to reflect the status of the chipmunk objects. Is there a quick way to return lists of objects within a world region? IE., for my rendering code, I'd like to know what bodies are at least partly contained within a certain rectangle. If such a function doesn't already exist, how can I get access to the bits necessary to write one?