2013-12-18 47 views
0

我需要从我的世界边界中移除某个矢量,例如只有左边的那个。 (Box2D的cocos2d的+ iPhone版)用box2D去除身体

我这是怎么设定的界限:

screenBorderShape.Set(lowerLeftCorner, lowerRightCorner); 
screenBorderBody->CreateFixture(&screenBorderShape, 0); 
screenBorderShape.Set(lowerRightCorner, upperRightCorner); 
screenBorderBody->CreateFixture(&screenBorderShape, 0); 
screenBorderShape.Set(upperRightCorner, upperLeftCorner); 
screenBorderBody->CreateFixture(&screenBorderShape, 0); 
screenBorderShape.Set(upperLeftCorner, lowerLeftCorner); 
screenBorderBody->CreateFixture(&screenBorderShape, 0); 

我如何删除只有左一个?

我知道这一点:

screenBorderBody->DestroyFixture(b2Fixture *fixture) 

但我需要做的,后来上,这样我就可以达到这个夹具(具有体指针),但不保存这个特定的一个作为一个全球性的?

谢谢。

回答

0

screenBorderShape.Set(lowerRightCorner,upperRightCorner); screenBorderBody-> CreateFixture(& screenBorderShape,0);

名称在该项赛事中左夹具或左墙....

这之后您可以使用screenBorderBody-> DestroyFixture(<#b2Fixture *夹具#>)

...

方式是

groundBox.Set(b2Vec2(X1/PTM_RATIO,Y1/PTM_RATIO),b2Vec2(X2/PTM_RATIO,Y1/PTM_RATIO)); bottomFixture = groundBody-> CreateFixture(& groundBoxDef);

然后卸下底部夹具(留在你的情况)

在caseyou只是想取消碰撞通过设置类别或屏蔽位这样做的