0
我們有固定裝置的兩個向量(所有一體的)斷言失敗:(fixture-> m_body ==本)
//Create and add fixtures to vector1 and vector2
b2PolygonShape shape1;
shape1.SetAsEdge(from1,to1);
vector1.push_back(body1->CreateFixture(&shape1,0));
b2PolygonShape shape2;
shape2.SetAsEdge(from2,to2);
vector2.push_back(body2->CreateFixture(&shape2,0));
當事件1的情況下,我們銷燬向量1第一夾具。
body1->DestroyFixture(vector1[0]); //destroy first fixture1
vector1.erase(vector1.begin()); //remove from vector1
當case2事件發生時,我們銷燬vector2中的第一個燈具。
body2->DestroyFixture(vector2[0]); //destroy first fixture2
vector2.erase(vector2.begin()); //remove from vector2
問題: 有時,當我們DestroyFixture(......),我們得到 「斷言失敗:(fixture-> m_body ==本)」
我檢查,我知道vector1可以有一些fixture2,或者vector2有fixture1。爲什麼會這樣? 我將fixture1僅添加到vector1,而fixture2僅添加到vector2。
這是問題的關鍵。謝謝 – Sinba 2012-03-24 20:35:43