This project has moved and is read-only. For the latest updates, please go here.

Getting Impules of the body that hits other bodys

Topics: Developer Forum, Project Management Forum, User Forum
Oct 7, 2010 at 9:13 AM

hello, everybody.

I can get the impulse of body hitted by other bodies like that.

fixture.PostSolve += PostSolve;

private void PostSolve(ContactConstraint contactConstraint)
            float maxImpulse = 0.0f;
            for (int i = 0; i < contactConstraint.Manifold.PointCount; ++i)
                maxImpulse = Math.Max(maxImpulse, contactConstraint.Manifold.Points[i].NormalImpulse);
            if (maxImpulse >= 20)
                isCrashed = true;

But this doesn't work well in case of getting the impulse of body that hits other bodies.

 how can I get the impulse of body that hits other bodies?

Oct 7, 2010 at 9:18 AM

You get the maximum impulse of the body you subscribed the PostSolve to. If you need the maximum impulse from other bodies, you have to subscribe the event on all the bodies.

Oct 7, 2010 at 9:23 AM

no, sorry, can't.

I will explain in detail.

For example, Let's image the catapult throws the stone and the stone hits other catapult.

in this case, the stone can hit the other catapult or hit the ground.

if the stone hits the ground, I can't get the impulse of stone at the moment.

Just at that time, the impulse of stone is 0.0f.

What's wrong?