Hi there! I started using chipmunk some weeks ago and I'm stuck with something that may be simple, but I can't solve it.
I want to know how many shapes are sorrounding another one (let's call it shapeA) within a certain distance.
My idea was to get the position of the body associated with shapeA (no problem with that) and then use cpSpacePointQuery, because it should call a func for each shape found along within a given distance. Then I can count how many times this func was called by cpSpacePointQuery.
But it didn't work, the program collapse when running with a segmentation fault (core dumped). When I build I don't receive errors nor warnings, and when I debug it says "#0 0x43421b cpSpatialIndexQuery(index=0x65b000, obj=0x7fffffffddb0, bb=..., func=0x434350 <NearestPointQuery>, data=0x0) (../include/chipmunk/cpSpatialIndex.h:210)
I haven't found an example of cpSpacePointQuery and I must be misunderstanding the headers. I've really checked the pointers declarations and initializations. Is it too much to ask a little example code for this? may be it's faster if I check the example and compare with my program.