<bdo id='ayHec'></bdo><ul id='ayHec'></ul>

      <i id='ayHec'><tr id='ayHec'><dt id='ayHec'><q id='ayHec'><span id='ayHec'><b id='ayHec'><form id='ayHec'><ins id='ayHec'></ins><ul id='ayHec'></ul><sub id='ayHec'></sub></form><legend id='ayHec'></legend><bdo id='ayHec'><pre id='ayHec'><center id='ayHec'></center></pre></bdo></b><th id='ayHec'></th></span></q></dt></tr></i><div id='ayHec'><tfoot id='ayHec'></tfoot><dl id='ayHec'><fieldset id='ayHec'></fieldset></dl></div>

    1. <small id='ayHec'></small><noframes id='ayHec'>

      1. <legend id='ayHec'><style id='ayHec'><dir id='ayHec'><q id='ayHec'></q></dir></style></legend>
        <tfoot id='ayHec'></tfoot>
      2. 在 cocos2d 中创建物理体

        时间:2024-08-12
          <tbody id='TB8VC'></tbody>

          <bdo id='TB8VC'></bdo><ul id='TB8VC'></ul>
          • <small id='TB8VC'></small><noframes id='TB8VC'>

              <legend id='TB8VC'><style id='TB8VC'><dir id='TB8VC'><q id='TB8VC'></q></dir></style></legend>
                <tfoot id='TB8VC'></tfoot>

                <i id='TB8VC'><tr id='TB8VC'><dt id='TB8VC'><q id='TB8VC'><span id='TB8VC'><b id='TB8VC'><form id='TB8VC'><ins id='TB8VC'></ins><ul id='TB8VC'></ul><sub id='TB8VC'></sub></form><legend id='TB8VC'></legend><bdo id='TB8VC'><pre id='TB8VC'><center id='TB8VC'></center></pre></bdo></b><th id='TB8VC'></th></span></q></dt></tr></i><div id='TB8VC'><tfoot id='TB8VC'></tfoot><dl id='TB8VC'><fieldset id='TB8VC'></fieldset></dl></div>

                  本文介绍了在 cocos2d 中创建物理体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 box2d 中创建物理身体,如下所示,这是我的代码

                  I am creating the physical body in box2d as below , this si my code

                   b2BodyDef carBodyDef;
                  carBodyDef.position.Set(x/PTM_RATIO,y/PTM_RATIO);
                  carBodyDef.type=b2_dynamicBody;    b2Body* carBody=physicsWorld->CreateBody(&carBodyDef);
                  
                  b2CircleShape carShape;
                  carShape.m_radius=rad/40.0f;
                  
                  
                  b2FixtureDef carFixture;
                  carFixture.shape=&carShape;
                  carFixture.density = 1.0f;
                  carFixture.friction = 0.0f;
                  
                  carBody->CreateFixture(&carFixture);
                  
                  return carBody ;
                  

                  当我运行应用程序时,它会崩溃,有以下错误*断言失败:(IsLocked() == false),函数 CreateBody,*in box2d

                  When am running the app, its getting crash , with the below erro *Assertion failed: (IsLocked() == false), function CreateBody,*in box2d

                  推荐答案

                  那是因为你在执行 b2WorldStep() 函数时创建了你的 body.执行此函数时无法创建新实体

                  That's because you are creating your body during execution of Step() function of b2World. You can't create new bodies while this function is executing

                  这篇关于在 cocos2d 中创建物理体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 cocos2d 中如何实现 touch hash code 并在后面引用呢? 下一篇:cocos2d v3 支持多屏幕分辨率?

                  相关文章

                  <i id='fO2Wv'><tr id='fO2Wv'><dt id='fO2Wv'><q id='fO2Wv'><span id='fO2Wv'><b id='fO2Wv'><form id='fO2Wv'><ins id='fO2Wv'></ins><ul id='fO2Wv'></ul><sub id='fO2Wv'></sub></form><legend id='fO2Wv'></legend><bdo id='fO2Wv'><pre id='fO2Wv'><center id='fO2Wv'></center></pre></bdo></b><th id='fO2Wv'></th></span></q></dt></tr></i><div id='fO2Wv'><tfoot id='fO2Wv'></tfoot><dl id='fO2Wv'><fieldset id='fO2Wv'></fieldset></dl></div>
                1. <tfoot id='fO2Wv'></tfoot>

                  • <bdo id='fO2Wv'></bdo><ul id='fO2Wv'></ul>
                    <legend id='fO2Wv'><style id='fO2Wv'><dir id='fO2Wv'><q id='fO2Wv'></q></dir></style></legend>

                    <small id='fO2Wv'></small><noframes id='fO2Wv'>