Ios4 _世界->;车身(车身B);在iphone的cocos2d中不会破坏身体

Ios4 _世界->;车身(车身B);在iphone的cocos2d中不会破坏身体,ios4,cocos2d-iphone,fixtures,Ios4,Cocos2d Iphone,Fixtures,代码如下: for(NSValue *fixtureValue in fixtures) { b2Fixture *fixture; fixture = (b2Fixture*)[fixtureValue pointerValue]; if(contact.fixtureA==fixture && contact.fixtureB == carFixture) { NSLog(@"Car hit outersquare!");

代码如下:

for(NSValue *fixtureValue in fixtures)
{
    b2Fixture *fixture;
    fixture = (b2Fixture*)[fixtureValue pointerValue];

        if(contact.fixtureA==fixture && contact.fixtureB == carFixture)
   {
      NSLog(@"Car hit outersquare!");
      [redcar stopAction:moveAction];
      _world->DestroyBody(bodyB);   // does not destroy body 
      [self createCarBody];
      speed = 0;
      break;
    }
 }

please help...

“bodyB”来自哪里?你是说

_world->DestroyBody(carFixture->GetBody());
或者类似的

无论如何,我建议您使用CCBox2D将Box2D与用于iphone的cocos2d结合使用


我读到,当你检查一具碰撞的尸体时,它无法被摧毁。但是,你可以将它添加到阵列中,并在尸体碰撞后销毁。@gixdev:我需要在汽车游戏中做以下事情:我有一个汽车精灵,它将以圆形轨道移动。我在车上使用“CCMoveBy”,如果车与轨道相撞,那么我想停车,然后毁坏车身。那么,你能给我一些代码吗。。。