I want to add a new broadphase to Chipmunk and need some help; I already found the cpSpatialIndex and cpSweep1D and I think I know how to proceed, but I have a problem...

If I understand correctly, the existing Chipmunk broadphases keep two spatial indexes, one for static and one for dynamic shapes. For dynamic/static collision they just test each dynamic BB against the whole static tree. (BTW, does the sweep1D really test every dynamic shape against all static shapes, i.e. N_d*N_s running time, or did I misunderstand that?!)

My broadphase needs the dynamic and static shapes in the same data structure (i.e. only one cpSpatialIndex, not divided into staticShapes and activeShapes) to be efficient; I would just flag all static bodies and not test for collisions among them. Is this possible without changing the rest of the Chipmunk code?

For example, in cpSpaceActivateBody():

- Code: Select all
`cpSpatialIndexRemove(space->staticShapes, shape, shape->hashid);`

cpSpatialIndexInsert(space->activeShapes, shape, shape->hashid);

unfortunately, insertions into my broadphase index are not very efficient, so I'd like to avoid unnecessary ones.

If I succeed and my broadphase turns out to be any good, I'll share the code, of course.

BTW, thanks for this great physics library!