Cocos2d-x scale physics body

  • pnyusb
    Likes 0

    Problem Description

    Hello, I use setSclale for my sprite like this but when I want to scale my physic body, I use this : auto physicsBody = PhysicsBody::createBox(sprite->getContentSize()); .

    It works, but I don’t understand why it doesn’t work with sprite->getBoundingBox().size then it seems more logical.


  • Sonar Systems admin
    Likes 0

    What do you get?

  • pnyusb
    Likes 0

    When I use getBoudingBox().size, the physic body is bigger than the sprite.

  • Sonar Systems admin
    Likes 0

    Is that after the scaling?

  • pnyusb
    Likes 0

    yes. It works with getContentSize().size however I thought it would work with getBoudingBox()

  • Sonar Systems admin
    Likes 0

    Bounding box size is independent.

Login to reply