Hi guys,
I want to make breakable objects so I need to find the maximum Impulse applied to a body and the point from the body where that Impulse is applied to. If that value is greater than a constant, than the object breaks.
In Flash version this is done very easy:
Help me to do the same thing in WCK.
I want to make breakable objects so I need to find the maximum Impulse applied to a body and the point from the body where that Impulse is applied to. If that value is greater than a constant, than the object breaks.
In Flash version this is done very easy:
Code:
override public function PostSolve(contact:b2Contact, impulse:b2ContactImpulse):void
{
// Should the body break?
var count:int = contact.GetManifold().m_pointCount;
var maxImpulse:Number = 0.0;
for (var i:int = 0; i < count; i++)
{
maxImpulse = b2Math.Max(maxImpulse, impulse.normalImpulses[i]);
}
if (maxImpulse > 50)
{
test.m_break = true;
}
}
{
// Should the body break?
var count:int = contact.GetManifold().m_pointCount;
var maxImpulse:Number = 0.0;
for (var i:int = 0; i < count; i++)
{
maxImpulse = b2Math.Max(maxImpulse, impulse.normalImpulses[i]);
}
if (maxImpulse > 50)
{
test.m_break = true;
}
}
Help me to do the same thing in WCK.