(JSB) Chipmunk: pointQueryFirst not working on device

(JSB) Chipmunk: pointQueryFirst not working on device
0.0 0


I was testing pointQueryFirst on an iPhone 4s and it didnt work.

I set a breakpoint at its c function:
cpSpacePointQueryFirst(cpSpace *space, cpVect point, cpLayers layers, cpGroup group)

the argument “layers” is always ZERO on device…

it DOES work on simulator though…

Whats the right procedure to report bugs and get it noticed? I also opened a ticket a the repo…


How did you test it ? Could you provide a demo to reproduce it? It ’ll be glad to test and find out what the problem is.


Hi James,

I used the latest version of cocos2d-x from the develop branch, I created a multiplataform (js) project using the python script provided with cocos2d-x.
Then I created a html5 project (also with latest version from develop branch), and I created a PhysicsLayer.js (attached file) to test chipmunk.

All that the PhysicsLayer.js does is create some boxes and 1 ball and simulates it, it also has a PivotJoint for grabbing the boxes and circles (I just followed the same steps provided by the chipmunk original examples).

At some point in my code I have to use the following function of chipmunk:
var shape = _space.pointQueryFirst(_mousePos, 1<<31, cp.NO_GROUP);
this version does work on web and iPhone simulator, but does NOT work on a iphone4s, by the time it reaches the original C function of chipmunk, the second argument (cpLayers) is always ZERO

however when I tried:
var shape = _space.pointQueryFirst(_mousePos, cp.ALL_LAYERS, cp.NO_GROUP);
it did work fine on web, iphone simulator and iphone 4s…

I think it might have something to do with the huge value passed for cpLayers?
Let me know if its a bug or did I just use it wrong?

ps: look at line 164 and 165 to toggle the bug…