Can I scale a shape in box2d as sprite do?

后端 未结 1 367
盖世英雄少女心
盖世英雄少女心 2021-01-17 07:23

As we always use the function in cocos2d,I can scale my sprite whenever I want.Can I do the same thing in box2d?For example, I created a circle shaped body,then I want to ma

相关标签:
1条回答
  • 2021-01-17 07:42

    If you are simply assigning shape.m_radius to a new value, it will not work.

    You need to reference the shape object associated with the b2Fixture that you created for your object:

    fixture->GetShape()->m_radius = new_radius/PTM_RATIO;
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题