I am attempting to build a Platform Game Engine and im using Box2D for physics. So far everything is good, its been hard work due to the lack of quality documentation, however its free so you get what you pay for. The problem I'm having an occurance of bodies been in contact and not in contact intermittently.
I beleive I've narrowed down the problem and I beleive its been caused due to my using lots of EdgeShapes in 1 body without them been 'linked' together. Searching the Box2D source code under the b2EdgeCollide code I did find that a check is done against m_vertex0 and 3 to see if the edge shape is connected to adjacent edge shapes. In the header of b2EdgeShape.h it also states EdgeShapes can be linked together, however there is no documentation on how to do this. Do I simply set m_vertex0 and 3 to the adjacent vertices of my Edgeshape when I create it? or is there a function that will do this for me because I doubt its been done automatically?
If I do have to connect them myself, I am assuming by 'adjacent vertex' it means the 1st vertex from the previous edgeshape? In ascii terms:
edge 1 edge 2
v1----v2v3----v4
Say I had edge 2 with vertices v3 and v4 I am assuming I would have to link m_vertex0 to v1 and not v2?
Thanks for any helpful replies.
Edit: Further research reveals that maybe this occurance is in b2CollideEdge.cpp where my Circle collides with the Edge but is in Region AB of the previous or next Edge and then when that next/previous edge is tested, the same conclusion is reached. example, Circle collides with Edge, is in Region AB of next Edge, next Edge is tested, Circle collides with Edge, is in Region AB of previous Edge? I beleive pointcount = 0 during this occurance which means isTouching = false. I might make modifications to Box2D to see if this is the case, but would prefer and answer here if possible.
I beleive I've narrowed down the problem and I beleive its been caused due to my using lots of EdgeShapes in 1 body without them been 'linked' together. Searching the Box2D source code under the b2EdgeCollide code I did find that a check is done against m_vertex0 and 3 to see if the edge shape is connected to adjacent edge shapes. In the header of b2EdgeShape.h it also states EdgeShapes can be linked together, however there is no documentation on how to do this. Do I simply set m_vertex0 and 3 to the adjacent vertices of my Edgeshape when I create it? or is there a function that will do this for me because I doubt its been done automatically?
If I do have to connect them myself, I am assuming by 'adjacent vertex' it means the 1st vertex from the previous edgeshape? In ascii terms:
edge 1 edge 2
v1----v2v3----v4
Say I had edge 2 with vertices v3 and v4 I am assuming I would have to link m_vertex0 to v1 and not v2?
Thanks for any helpful replies.
Edit: Further research reveals that maybe this occurance is in b2CollideEdge.cpp where my Circle collides with the Edge but is in Region AB of the previous or next Edge and then when that next/previous edge is tested, the same conclusion is reached. example, Circle collides with Edge, is in Region AB of next Edge, next Edge is tested, Circle collides with Edge, is in Region AB of previous Edge? I beleive pointcount = 0 during this occurance which means isTouching = false. I might make modifications to Box2D to see if this is the case, but would prefer and answer here if possible.
