I'm using mousejoint to drag bodies in box2d, but it causes inertial delay.
Does it exist any way to drag a body instantaneously?
The solution is to tune up properties frequencyHz and dampingRatio in your b2MouseJointDef.
For example:
b2MouseJointDef md;
md.body1 = _groundBody;
md.body2 = body;
md.target = p;
md.maxForce = 10000.0f * body->GetMass();
md.dampingRatio = 0;
md.frequencyHz = 100;
_world->CreateJoint(&md);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With