..or so.. i am not exactly sure what is causing this. I just found (it took me 7 hours 🙁 ) that an exception occurs probably when i create some physics body, remove it and then create another and move it to the same location - all between 2 solver steps. It looks like pairs are created right when i create a body. But then after creating the other one, pairs are created with the body that no longer exist. Therefore creating the second body throws an memory access exception. Tracking down the call stack i got to the fixture pointer of value 0xfdfdfdfd or 0xfdfdfe05(?)
All of above is just my guess, but doing a short simulation step before the last body creation seems to fix the problem. Since this problem only occurs when i destroy the entire level, it's not a big deal...
not sure how to properly post the call stack (vs2008)
fixtureA = 0xfdfdfdfd
All of above is just my guess, but doing a short simulation step before the last body creation seems to fix the problem. Since this problem only occurs when i destroy the entire level, it's not a big deal...
not sure how to properly post the call stack (vs2008)
Code:
> gizmo fray_d.exe!b2Fixture::GetBody() Line 275 + 0x3 bytes C++
gizmo fray_d.exe!b2ContactManager::AddPair(void * proxyUserDataA=0x05f92d88, void * proxyUserDataB=0x05f92ca8) Line 188 + 0x8 bytes C++
gizmo fray_d.exe!b2BroadPhase::UpdatePairs<b2ContactManager>(b2ContactManager * callback=0x0344d5d8) Line 218 C++
gizmo fray_d.exe!b2ContactManager::FindNewContacts() Line 175 C++
gizmo fray_d.exe!b2Body::SetTransform(const b2Vec2 & position={...}, float angle=0.00000000) Line 426 C++
gizmo fray_d.exe!EntPhys::SetPosition(const b2Vec2 & pos={...}, bool clientside=false) Line 228 C++
gizmo fray_d.exe!b2ContactManager::AddPair(void * proxyUserDataA=0x05f92d88, void * proxyUserDataB=0x05f92ca8) Line 188 + 0x8 bytes C++
gizmo fray_d.exe!b2BroadPhase::UpdatePairs<b2ContactManager>(b2ContactManager * callback=0x0344d5d8) Line 218 C++
gizmo fray_d.exe!b2ContactManager::FindNewContacts() Line 175 C++
gizmo fray_d.exe!b2Body::SetTransform(const b2Vec2 & position={...}, float angle=0.00000000) Line 426 C++
gizmo fray_d.exe!EntPhys::SetPosition(const b2Vec2 & pos={...}, bool clientside=false) Line 228 C++
Code:
void b2ContactManager::AddPair(void* proxyUserDataA, void* proxyUserDataB)
{
b2FixtureProxy* proxyA = (b2FixtureProxy*)proxyUserDataA;
b2FixtureProxy* proxyB = (b2FixtureProxy*)proxyUserDataB;
b2Fixture* fixtureA = proxyA->fixture;
b2Fixture* fixtureB = proxyB->fixture;
int32 indexA = proxyA->childIndex;
int32 indexB = proxyB->childIndex;
b2Body* bodyA = [b][color=#FF0000]fixtureA[/color][/b]->GetBody();
b2Body* bodyB = fixtureB->GetBody();
{
b2FixtureProxy* proxyA = (b2FixtureProxy*)proxyUserDataA;
b2FixtureProxy* proxyB = (b2FixtureProxy*)proxyUserDataB;
b2Fixture* fixtureA = proxyA->fixture;
b2Fixture* fixtureB = proxyB->fixture;
int32 indexA = proxyA->childIndex;
int32 indexB = proxyB->childIndex;
b2Body* bodyA = [b][color=#FF0000]fixtureA[/color][/b]->GetBody();
b2Body* bodyB = fixtureB->GetBody();
fixtureA = 0xfdfdfdfd