I need to create a pivot joint on an object with an offset anchor point. In Cocos2d HTML5, I was able to pass both anchorpoints, and it worked perfectly.
new cp.PivotJoint(body1, body2, anchorForBody1, anchorForBody2);
However, in JSB, the constructor only takes three arguments. So when I try the following, it works, but the body is pivoted at its centre.
new cp.PivotJoint(body1, body2, anchorForBody1);
So I tried this method, which I found from the chipmunk bindings.
cp.pivotJointNew2(body1, body2, anchorForBody1, anchorForBody2);
However, it doesn’t work and throws the following error.
D/cocos2d-x debug info( 996): jsb: ERROR: File /home/hari/dev/sdk/cocos2d-2.1rc0-x-2.1.2/PaddleShift/proj.android/../../scripting/javascript/bindings/ScriptingCore.cpp: Line: 951, Function: jsval_to_int32 D/cocos2d-x debug info( 996): Error processing arguments D/cocos2d-x debug info( 996): jsb: ERROR: File /home/hari/dev/sdk/cocos2d-2.1rc0-x-2.1.2/PaddleShift/proj.android/../../scripting/javascript/bindings/ScriptingCore.cpp: Line: 951, Function: jsval_to_int32 D/cocos2d-x debug info( 996): Error processing arguments D/cocos2d-x debug info( 996): jsb: ERROR: File /home/hari/dev/sdk/cocos2d-2.1rc0-x-2.1.2/PaddleShift/proj.android/../../scripting/javascript/bindings/js_bindings_chipmunk_functions.cpp: Line: 2558, Function: JSB_cpPivotJointNew2 D/cocos2d-x debug info( 996): Error processing arguments D/cocos2d-x debug info( 996): JS: assets/GamePhysics.js:72:InternalError: too much recursion
Does anyone know how this can be fixed?