How to stop a b2body instantly?

Hi I'm new here 😉

how can i stop a linearimpulse? How can i stop a body INSTANTLY?
❓

Is there something like

mybody->StopLinearImpulse()
try to apply equal but opposite to the body...and look at

Code: Select all

   body->SetLinearDamping(0);
   body->SetAngularDamping(0);
   body->SetAngularVelocity(0);
   body->SetLinearVelocity(b2vec2(0,0));
More explicitly ...


Code: Select all

mybody->SetLinearVelocity(b2vec2(-mybody->GetLinearVelocity().x, -mybody->GetLinearVelocity().y ));
or
mybody->SetLinearVelocity(b2Vec2(-mybody->GetLinearVelocity() ));



Do the same for angle (mybody->GetAngle() ... etc)

I think that should work.

Original thread: https://box2d.org/forum/viewtopic.php?t=6084