PDA

View Full Version : [box2d] damping/physics


Kimchee
04-20-2009, 07:20 AM
This is for users who know box2d.

I am making a miniature golf game using box2d and so far so good; however, the ball never stops rolling. I have the gravity vector as 0,0, and damping = 1 but still no slowing.

Any suggestions?

bluemagica
04-20-2009, 12:10 PM
can you show your code? and have you checked the angularDamping?

Kimchee
04-20-2009, 11:38 PM
function placeBall(theX, theY){

bDef.position.Set(theX/30,theY/30);
var circleDef = new b2CircleDef();



circleDef.radius= 15/60;
circleDef.density = 10;
circleDef.friction = 0;
circleDef.restitution = 1;
body = the_world.CreateBody(bDef);
body.CreateShape(circleDef);
body.SetMassFromShapes();

bDef.linearDamping = 10;
bDef.angularDamping = 10;



}

Creates ball just perfect, but no friction from Damping? Strange???
P.S. bDef is the declared in code above so it is public and not bound to the function, but I have tried with it being declared in the function and still same trouble, no friction. So that is not the problem.