@sketchbookgames I managed to get your method working without WCK by using the impulse passed in PostSolve like this:
Code:
public function PostSolve(c:int, a:b2Fixture, b:b2Fixture, bias:int, i:int):void
{
var impulse:b2ContactImpulse = new b2ContactImpulse(i);
var normalLength:Number = Math.sqrt( (impulse.normalImpulse1*impulse.normalImpulse1) + (impulse.normalImpulse2*impulse.normalImpulse2) );
trace("impulse: "+normalLength);
}
And it does indeed seem better, so thank you very much! ... i'm not sure how to get it working in begin contact, which would probably be better because it gets called far less than PostSolve.
@mayobutter
First, it would be interesting to know how you tackle the above problem, or even just how i could get sketchbookgames version working in beginContact without the WCK contact system.
Second, think i found some bugs!
I updated to the latest version and got a null object reference error, i noticed b2Base.initialize() missing in the constructor of the new version of b2World, i put that back in and everything seems to work fine now.
Contacts, m_reportBeginContact etc don't seem to work, all the events get called no matter what they are set too, you can see this if you put some traces in the BeginContact / EndContact / PreSolve / PostSolve methods of b2World, i get a stream of PreSolve and BeginContact's even though all reports are turned off. At the moment to make things work properly i am manualy checking the report flags before calling the relevent function.
Not sure if this one is a bug but Weld and Friction joints cant be created using world.CreateJoint(jointDef), you have to call jointDef.create(world) instead, also debug draw causes an error when using Weld joints because of null v2's in DrawSegment()
I changed it to:
Code:
public function DrawSegment(p1:V2, p2:V2):void {
if ((p1 != null) && (p2 != null))
{
graphics.moveTo(p1.x * scale, p1.y * scale);
graphics.lineTo(p2.x * scale, p2.y * scale);
}
}