[RESOLVED]How to make a physics body using physics body editor in spritesheet

I have made a spritesheet. I am not able to make a sprite physics body using physics body editor. Below is my code :-

   SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();

    frameCache->addSpriteFramesWithFile("animations/TexPac.plist");

    SpriteBatchNode *spriteSheet = SpriteBatchNode::create("animations/TexPac.png");

    this->addChild(spriteSheet, 20);

    Sprite *tiger5 = Sprite::createWithSpriteFrameName("Tiger1.png");
    tiger5->setScale(0.5);
    tiger5->setPosition(Vec2(visibleSize.width/4, visibleSize.height/2));
    
    MyBodyParser::getInstance()->parseJsonFile( "animations/tigerBody.json" );
    auto spriteBody2 = MyBodyParser::getInstance()->bodyFormJson(tiger5, "Tiger1", PhysicsMaterial( 0, 1, 0 ) );
    spriteBody2->setCollisionBitmask(1);
    spriteBody2->setContactTestBitmask(true);

    if ( spriteBody2 != nullptr )
      {
       spriteBody2->setDynamic( false );
       tiger5->setPhysicsBody( spriteBody2 );
      }

    spriteSheet->addChild(tiger5, 20);

Can you tell me what is happening or the trouble you are experiencing?

When i am removing given below 2 statements from the code ,it is running without any error.
  spriteBody2->setCollisionBitmask(1);
    spriteBody2->setContactTestBitmask(true);

The physics body also not showing outline around it. i have used the statement given below for showing outline:-
scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);

well this statement is not correct, I think it should be a number or mask.

This statement is working for the sprites which are not inside the spritesheet. So i think this is not error in my case.

My gosh, so sorry, I misread the type of spriteBody2

Is there any tutorial which can teach me how to make physics body using spritesheet?

I don’t know of one. If you can make me a quick sample that I can drop into the stock ‘Hello World’ sample I can look and ask some engineers for advice.

The code is same as given above.

animations - it is a folder inside resource folder.
Tiger1.png - it is one of the image inside spritesheet TexPac.png.
tigerBody.json - it is a file made in the physics body editor.

Do you require any more information?

Can you send me those items so I can drop it in and be working with your exact items?

You can PM me if you want. It would help me track it better.

My problem got solved. I did a mistake in the statement given below :-
auto spriteBody2 = MyBodyParser::getInstance()->bodyFormJson(tiger5, “Tiger1”, PhysicsMaterial( 0, 1, 0 ) );
The second argument “Tiger1” is wrong. When i opened the json file, there the name of the body is given “Tiger2”. So, when i changed the name from “Tiger1” to “Tiger2” , the game is running perfectly.