2 Doubts:
1) I want to add my physics body.
I wrote this code following chapter 5 of Parkour tutorial and Chipmunk documentation here:
http://chipmunk-physics.net/release/ChipmunkLatest-Docs/
This is my Code: that I wrote within my initPhysics:function()
var ballSprite= cc.PhysicsSprite.create(resG.Player_png);
var contentSize = ballSprite.getContentSize();
var ballBody= new cp.Body(1,cp.momentForBox(1, contentSize.width, contentSize.height));
ballBody.p=cc.p(centerPos.x,centerPos.y+40);
ballBody.applyImpulse(cp.v(150, 0), cp.v(0, 0));//run speed
var ballShape= new cp.CircleShape(ballBody, contentSize.width/2, cp.v(contentSize.width/2,contentSize.height/2));
this.space.addBody(ballBody);
this.space.addShape(ballShape);
ballSprite.setBody(ballBody);
This is not displaying anything on the screen.
Is there anything wrong with it. Or something else can be wrong.
Tell me give you the entire program if there is no problem with the above.
2)
I want to display debug boundaries of those physics(the red color Boundaries)
So, for this I added this code:
This Statement in the last of initPhysics:function()
this.setupDebugNode();
And then added this function after initPhysics:function()
setupDebugNode : function()
{
// debug only
this._debugNode = new cc.PhysicsDebugNode(this.space );
this._debugNode.visible = true ;
this.addChild( this._debugNode,6 );
},
But it is not showing anything.
Infact it is not even showing the physics Body(with sprite) which is my first doubt
Thanks