Hey there, I would like to create a shake effect for a b2Body kinematic body that is about to fall on the ground.I have tried ApplyForce, but the effect is too quick which goes unnoticed. I have tried ApplyLinearImpulse which too does not produce the desired result. what I have done so far is this
b2Vec2 force.
force.Set(20.0,0);
b2Body *body;
body.type = b2_kinematicBody;
In Step function
for( all the list of bodies in the world)
{
if(body is of type 'A')
{
force.Set(20.0,0);
body->ApplyForce(force,body->GetPosition());
force.Set(-20.0,0);
body->ApplyForce(force,body->GetPosition());
}
}
The above is just a pseudocode. The force should push the body towards right and left to produce a shake effect. But it's too fast, as a result it goes unnoticed. Please help. Thanks in Advance
b2Vec2 force.
force.Set(20.0,0);
b2Body *body;
body.type = b2_kinematicBody;
In Step function
for( all the list of bodies in the world)
{
if(body is of type 'A')
{
force.Set(20.0,0);
body->ApplyForce(force,body->GetPosition());
force.Set(-20.0,0);
body->ApplyForce(force,body->GetPosition());
}
}
The above is just a pseudocode. The force should push the body towards right and left to produce a shake effect. But it's too fast, as a result it goes unnoticed. Please help. Thanks in Advance