【发布时间】:2012-03-24 17:44:53
【问题描述】:
我们有两个固定装置向量(都是一个主体)
//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) );
当case event1时,我们销毁vector1中的第一个fixture。
body1->DestroyFixture( vector1[0] ); //destroy first fixture1
vector1.erase( vector1.begin() ); //remove from vector1
当case event2时,我们销毁vector2中的第一个fixture。
body2->DestroyFixture( vector2[0] ); //destroy first fixture2
vector2.erase( vector2.begin() ); //remove from vector2
问题: 有时,当我们 DestroyFixture(...) 时,我们会得到“Assertion failed: (fixture->m_body == this)”
我查了一下,我知道vector1可以有一些fixture2,或者vector2有fixture1。为什么会这样? 我只将fixture1 添加到vector1,将fixture2 仅添加到vector2。
【问题讨论】:
标签: iphone c++ cocos2d-iphone box2d