I'm getting the following assertion.

I'm saving the b2Body pointers in Array. The assertion happens when I call
More precisely, in b2Body.cpp, line 115:
The whole problem occurs after it already worked once...I can create one body using my code without problems, but during creation of the second body it looks like the above for-loop tries to call shape->m_next = m_shapeList; even though there are no more shapes defined for that body and then crashes. I first thought some maximum limit of shapes or such has been reached, but the error is independent from any certain numbers. It always happens during creation of the second body, when Box2D has added all the valid shapes in my b2BoxDef, and is obviously trying to add one too much. Meaning the bodyDef has 24 shapes, and at this error occurs at shape 25. Here's what it says in the debugging window when inside b2Body.cpp after the error (sorry about the bad formatting):
Has anyone had this problem before?
I'm saving the b2Body pointers in Array. The assertion happens when I call
Code:
b2BodyStorage[ *storagePosition ] = world->CreateBody( temp );
More precisely, in b2Body.cpp, line 115:
Code:
// Create the shapes.
m_shapeList = NULL;
for (int32 i = 0; i < m_shapeCount; ++i)
{
const b2ShapeDef* sd = bd->shapes[i];
b2Shape* shape = b2Shape::Create(sd, this, m_center);
shape->m_next = m_shapeList; // <-- CRASH in line 115
m_shapeList = shape;
}
m_shapeList = NULL;
for (int32 i = 0; i < m_shapeCount; ++i)
{
const b2ShapeDef* sd = bd->shapes[i];
b2Shape* shape = b2Shape::Create(sd, this, m_center);
shape->m_next = m_shapeList; // <-- CRASH in line 115
m_shapeList = shape;
}
The whole problem occurs after it already worked once...I can create one body using my code without problems, but during creation of the second body it looks like the above for-loop tries to call shape->m_next = m_shapeList; even though there are no more shapes defined for that body and then crashes. I first thought some maximum limit of shapes or such has been reached, but the error is independent from any certain numbers. It always happens during creation of the second body, when Box2D has added all the valid shapes in my b2BoxDef, and is obviously trying to add one too much. Meaning the bodyDef has 24 shapes, and at this error occurs at shape 25. Here's what it says in the debugging window when inside b2Body.cpp after the error (sorry about the bad formatting):
Code:
- shape 0x00000000 {m_next=??? m_R={...} m_position={...} ...} b2Shape *
__vfptr CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_next CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
+ m_R {col1={...} col2={...} } b2Mat22
+ m_position {x=??? y=??? } b2Vec2
m_type CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_userData CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_body CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_friction CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_restitution CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_maxRadius CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_proxyId CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_categoryBits CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_maskBits CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_groupIndex CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
+ sd 0x00a37a88 {type=26732720 userData=0x00000000 localPosition={...} ...} const b2ShapeDef *
i 0 int
i 24 int
i 24 int
+ this 0x0197405c {m_flags=1 m_position={...} m_rotation=0.00000000 ...} b2Body * const
+ bd 0x01975e58 {userData=0x00000000 shapes=0x01975e5c position={...} ...} const b2BodyDef *
+ world 0x0195a6f8 {m_blockAllocator={...} m_stackAllocator={...} m_broadPhase=0x01220044 ...} b2World *
+ massDatas 0x0013e3e0 {mass=0.00000000 center={...} I=0.00000000 } b2MassData [256]
__vfptr CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_next CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
+ m_R {col1={...} col2={...} } b2Mat22
+ m_position {x=??? y=??? } b2Vec2
m_type CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_userData CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_body CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_friction CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_restitution CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_maxRadius CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_proxyId CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_categoryBits CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_maskBits CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
m_groupIndex CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden
+ sd 0x00a37a88 {type=26732720 userData=0x00000000 localPosition={...} ...} const b2ShapeDef *
i 0 int
i 24 int
i 24 int
+ this 0x0197405c {m_flags=1 m_position={...} m_rotation=0.00000000 ...} b2Body * const
+ bd 0x01975e58 {userData=0x00000000 shapes=0x01975e5c position={...} ...} const b2BodyDef *
+ world 0x0195a6f8 {m_blockAllocator={...} m_stackAllocator={...} m_broadPhase=0x01220044 ...} b2World *
+ massDatas 0x0013e3e0 {mass=0.00000000 center={...} I=0.00000000 } b2MassData [256]
Has anyone had this problem before?