@BorisTheBrave:
This is so amazing! As I am getting around to doing more testing with my current game I realize I have a very functional use for them. I don't see the lack of arc-arc collisions as a big limitation because I think they are most useful as part of the environment. Obviously it would be cool if we had those too, but I can't think of a whole lot of uses for them. I'm currently merging the code into my slightly modified Box2D setup (sensors and such). The only problem I'm running into is that I'm using Flexbuilder 2 with strict typing, so I'm getting tons of warnings about untyped variables. It's no problem to go through and assign the correct types for the most part, but I'm a bit confused about this one spot in b2ConcaveArcDef.as. It's in this block of code at the bottom:
When I saw v=2/3*r I assumed r should be a Number, but I see that r is actually declared below that point (which I know Flash allows) but is set to b2Math.SubtractVV(polyMass.center, massData.center); which returns a b2Vec2... So I'm not sure what's going on here. I don't know if they're being used as two different variables, but it seems like r might be considered a Number just by being multiplied with 2/3 and then it gets redefined later and behaves as a b2Vec2. Any clarification on this would be appreciated, I can't wait to play with it!
And once again thanks for this addition to Box2D!!
This is so amazing! As I am getting around to doing more testing with my current game I realize I have a very functional use for them. I don't see the lack of arc-arc collisions as a big limitation because I think they are most useful as part of the environment. Obviously it would be cool if we had those too, but I can't think of a whole lot of uses for them. I'm currently merging the code into my slightly modified Box2D setup (sensors and such). The only problem I'm running into is that I'm using Flexbuilder 2 with strict typing, so I'm getting tons of warnings about untyped variables. It's no problem to go through and assign the correct types for the most part, but I'm a bit confused about this one spot in b2ConcaveArcDef.as. It's in this block of code at the bottom:
Code:
var v:Number = 2/3 * d / theta;
if(theta < Number.MIN_VALUE) v=2/3*r;
segMass.center = new b2Vec2(arcCenter.x - normx*v, arcCenter.y - normy*v);
segMass.I = 0.5 * segMass.mass * radius2 - segMass.mass * v * v;
//Now merely add the three masses together
massData.mass = polyMass.mass + triMass.mass + segMass.mass;
if(massData.mass>Number.MIN_VALUE)
{
massData.center.x = polyMass.mass*polyMass.center.x + triMass.mass*triMass.center.x + segMass.mass*segMass.center.x;
massData.center.y = polyMass.mass*polyMass.center.y + triMass.mass*triMass.center.y + segMass.mass*segMass.center.y;
massData.center.x /= massData.mass;
massData.center.y /= massData.mass;
massData.I = polyMass.I + triMass.I + segMass.I;
var r = b2Math.SubtractVV(polyMass.center, massData.center);
massData.I += polyMass.mass * b2Math.b2Dot(r, r);
r = b2Math.SubtractVV(triMass.center, massData.center);
massData.I += triMass.mass * b2Math.b2Dot(r, r);
r = b2Math.SubtractVV(segMass.center, massData.center);
massData.I += segMass.mass * b2Math.b2Dot(r, r);
}
}
if(theta < Number.MIN_VALUE) v=2/3*r;
segMass.center = new b2Vec2(arcCenter.x - normx*v, arcCenter.y - normy*v);
segMass.I = 0.5 * segMass.mass * radius2 - segMass.mass * v * v;
//Now merely add the three masses together
massData.mass = polyMass.mass + triMass.mass + segMass.mass;
if(massData.mass>Number.MIN_VALUE)
{
massData.center.x = polyMass.mass*polyMass.center.x + triMass.mass*triMass.center.x + segMass.mass*segMass.center.x;
massData.center.y = polyMass.mass*polyMass.center.y + triMass.mass*triMass.center.y + segMass.mass*segMass.center.y;
massData.center.x /= massData.mass;
massData.center.y /= massData.mass;
massData.I = polyMass.I + triMass.I + segMass.I;
var r = b2Math.SubtractVV(polyMass.center, massData.center);
massData.I += polyMass.mass * b2Math.b2Dot(r, r);
r = b2Math.SubtractVV(triMass.center, massData.center);
massData.I += triMass.mass * b2Math.b2Dot(r, r);
r = b2Math.SubtractVV(segMass.center, massData.center);
massData.I += segMass.mass * b2Math.b2Dot(r, r);
}
}
When I saw v=2/3*r I assumed r should be a Number, but I see that r is actually declared below that point (which I know Flash allows) but is set to b2Math.SubtractVV(polyMass.center, massData.center); which returns a b2Vec2... So I'm not sure what's going on here. I don't know if they're being used as two different variables, but it seems like r might be considered a Number just by being multiplied with 2/3 and then it gets redefined later and behaves as a b2Vec2. Any clarification on this would be appreciated, I can't wait to play with it!
And once again thanks for this addition to Box2D!!