<tfoot id='YSa7I'></tfoot>
  • <i id='YSa7I'><tr id='YSa7I'><dt id='YSa7I'><q id='YSa7I'><span id='YSa7I'><b id='YSa7I'><form id='YSa7I'><ins id='YSa7I'></ins><ul id='YSa7I'></ul><sub id='YSa7I'></sub></form><legend id='YSa7I'></legend><bdo id='YSa7I'><pre id='YSa7I'><center id='YSa7I'></center></pre></bdo></b><th id='YSa7I'></th></span></q></dt></tr></i><div id='YSa7I'><tfoot id='YSa7I'></tfoot><dl id='YSa7I'><fieldset id='YSa7I'></fieldset></dl></div>
    • <bdo id='YSa7I'></bdo><ul id='YSa7I'></ul>
  • <legend id='YSa7I'><style id='YSa7I'><dir id='YSa7I'><q id='YSa7I'></q></dir></style></legend>
  • <small id='YSa7I'></small><noframes id='YSa7I'>

      1. 如何在box2d中停止作用在身体上的力

        How to stop the forces acting on a body in box2d(如何在box2d中停止作用在身体上的力)

        <legend id='p5nLq'><style id='p5nLq'><dir id='p5nLq'><q id='p5nLq'></q></dir></style></legend>

              <tbody id='p5nLq'></tbody>

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

                <bdo id='p5nLq'></bdo><ul id='p5nLq'></ul>
                1. <tfoot id='p5nLq'></tfoot>
                  <i id='p5nLq'><tr id='p5nLq'><dt id='p5nLq'><q id='p5nLq'><span id='p5nLq'><b id='p5nLq'><form id='p5nLq'><ins id='p5nLq'></ins><ul id='p5nLq'></ul><sub id='p5nLq'></sub></form><legend id='p5nLq'></legend><bdo id='p5nLq'><pre id='p5nLq'><center id='p5nLq'></center></pre></bdo></b><th id='p5nLq'></th></span></q></dt></tr></i><div id='p5nLq'><tfoot id='p5nLq'></tfoot><dl id='p5nLq'><fieldset id='p5nLq'></fieldset></dl></div>
                  本文介绍了如何在box2d中停止作用在身体上的力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 iphone 上使用 box2d 来创建游戏.我有一个受重力影响的身体向下移动而不是向右或向左移动.它会被另一个物体击中,然后向右或向左移动.然后我有一个重置按钮,可以将身体移回起点.唯一的问题是它仍在向右或向左移动.我怎样才能抵消球已经在移动的力?重置游戏时如何消除这种左右移动?

                  I am using box2d on the iphone to create a game. I have a body that is effected by gravity to move down and not right or left. It will get hit by another body and will then be moving right or left. I then have a reset button which moves the body back to its starting point. The only problem is that it is still moving right or left. How can I counteract the forces that a ball is already traveling? How can I get rid of this right and left movement when I reset my game?

                  推荐答案

                  Box2d 自动清除每个模拟步骤的力.我认为你只是在重置时改变了身体的位置,而不是它的速度.将此代码添加到您的重置方法中:

                  Box2d automatically clears the forces each simulation step. I think you are just changing your body's position when resetting, but not its velocity. Add this code to your reset method:

                  body->SetLinearVelocity(b2Vec2(0,0));
                  body->SetAngularVelocity(0);
                  

                  这篇关于如何在box2d中停止作用在身体上的力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                    <tbody id='t4c8O'></tbody>

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

                    • <tfoot id='t4c8O'></tfoot>
                        <bdo id='t4c8O'></bdo><ul id='t4c8O'></ul>

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