Hi, I'm new to Box2d(Flash), and was just playing around to find out it's capabilities, and ease of extension. But with my very simple test world, I keep on getting broken behaviour: sharp corners of static polygons (<50 degrees) can stab into other polygon edges.
It seems from a bit of testing, that it is behaving as if there is no vertex there at all, the only collisions dealt with are where it is definitively hitting one edge.
Here is some sample code to reproduce. Simply replace the function TestBridge in the demo program for v1.4.3 with this to observe the behaviour. I have positioned a free floating square inside a sharp static angle, but it is not kicked out. The positioning is merely for convenience, you can get such bugs while continuously moving the square from outside. Giving pd a positive density, or picking a larger angle resolves the problem.
Am I missing something or it this just plain wrong?
It seems from a bit of testing, that it is behaving as if there is no vertex there at all, the only collisions dealt with are where it is definitively hitting one edge.
Here is some sample code to reproduce. Simply replace the function TestBridge in the demo program for v1.4.3 with this to observe the behaviour. I have positioned a free floating square inside a sharp static angle, but it is not kicked out. The positioning is merely for convenience, you can get such bugs while continuously moving the square from outside. Giving pd a positive density, or picking a larger angle resolves the problem.
Code: Select all
public function TestBridge(){
Main.m_aboutText.text = "Custom";
m_world.m_gravity.SetZero();
var bd:b2BodyDef;
var sd:b2BoxDef = new b2BoxDef();
sd.extents.Set(20, 20);
sd.density=0.4;
bd = new b2BodyDef();
bd.AddShape(sd);
bd.position.Set(210, 110);
m_world.CreateBody(bd);
var pd:b2PolyDef = new b2PolyDef();
pd.vertexCount=3;
pd.vertices[0].Set(100,0);
pd.vertices[1].Set(0,100);
pd.vertices[2].Set(0,0);
pd.density=0.0;
bd = new b2BodyDef();
bd.AddShape(pd);
bd.position.Set(100, 100);
m_world.CreateBody(bd);
}
Am I missing something or it this just plain wrong?