Closed GoogleCodeExporter closed 8 years ago
Sorry for the delay, I've been working on a lot of contract work lately.
I can add the call to cpShapeCacheBB() back, but it sounds like there is a
bigger problem here. Somehow it's possible to insert a shape into the spatial
hashes without the shape's bounding box (and other collision data) being
updated. That should not be able to happen.
I'm not sure how the bounding box is full of garbage either, iirc it should be
calloced. I'll have to look into this more.
Original comment by slemb...@gmail.com
on 28 Sep 2010 at 7:59
I think I found the bug that was causing this and fixed it.
In cpSpaceAddShape() I was not calling cpShapeCacheBB() when inserting active
objects. My intention was to delay the call to cpShapeCacheBB() until it was
actually added. The point was to make queries work before calling
cpSpaceStep(). I guess I forgot to actually add it to the new spot. :-\
If the shape was not zeroed when it was allocated, it would have any old random
bounding box for it. Adding a shape with a zeroed bounding box is fine unless
you were actually trying to query. Junk bounding boxes of course can be very
bad. I guess I should have actually tested what I was trying to fix. (/me
facepalm)
Original comment by slemb...@gmail.com
on 30 Sep 2010 at 9:42
Original comment by slemb...@gmail.com
on 30 Sep 2010 at 9:42
Thanks for tracking this one down. It was not calloced, it was alloced into a
pinned object in GC area of the Haskell run time system.
Cheers!
Original comment by felipe.l...@gmail.com
on 30 Sep 2010 at 9:48
Yeah, I figured as much. Chipmunk's init functions aren't supposed to assume
zeroed memory, but I rarely test it that way. I use calloc in the allocation
functions to track down bugs faster, and most GCs that I've worked with return
zeroed memory.
Hopefully that was the bug then. Cheers.
Original comment by slemb...@gmail.com
on 30 Sep 2010 at 10:04
Original issue reported on code.google.com by
felipe.l...@gmail.com
on 26 Sep 2010 at 2:35