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

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

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

  2. <legend id='Rf8MN'><style id='Rf8MN'><dir id='Rf8MN'><q id='Rf8MN'></q></dir></style></legend>
  3. <tfoot id='Rf8MN'></tfoot>

    1. LibGDX - 围绕它们的中心旋转一个 2d 精灵数组

      时间:2023-05-18

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

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

                  <tbody id='Tks6R'></tbody>
              1. <legend id='Tks6R'><style id='Tks6R'><dir id='Tks6R'><q id='Tks6R'></q></dir></style></legend>
              2. 本文介绍了LibGDX - 围绕它们的中心旋转一个 2d 精灵数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有一个正方形的 2d 精灵数组,我试图将它们全部围绕地图的中心位置旋转,但经过多次尝试,精灵似乎只围绕它们自己的中心旋转.这可能吗?

                I have a square 2d array of sprites and im trying to rotate all of them around the center position of the map, but after many attempts the sprites seem to be only rotating around their own center. Is this possible?

                推荐答案

                首先想到的是,如果我理解你的问题,你告诉所有精灵必须旋转的点在哪里:sprite.setOrigin(yourPointVector2.x, yourPointVector2.y);sprite.rotation(yourRotation);

                the first thing that comes to mind is, if I understand your question, you tell all sprites where is the point which must rotate using: sprite.setOrigin(yourPointVector2.x, yourPointVector2.y); sprite.rotation(yourRotation);

                编辑新的为您的评论编辑

                1 次精灵旋转的简单测试,也许不是最好的方法,但我现在想到了.这样可以帮助您,如果您的精灵位于地图的 50.50,并且地图的中心为 400、240,我将创建一个变量来存储精灵的初始位置,

                simple test for 1 sprite rotation, maybe is not the best way but it occurred to me that right now. Like this helps you, if your sprite is at 50.50, of the your map, and the center of your map is 400, 240, I would create a variable that will store the initial position of the sprite,

                示例:

                //is stored only once, because if not will store where you are during rotation
                
                yourVectorPosInicial.x = sprite.getX();
                yourVectorPosInicial.v = sprite.getY();
                
                yourVectorCenterMap.x = 400f;
                yourVectorCenterMap.y = 240f;` 
                
                youtSprite.setOrigin(yourVectorCenterMap.x-yourVectorPosInicial.x , 
                                     yourVectorCenterMap.y-yourVectorPosInicial.y);
                
                //this in your Draw or update render
                
                sprite.rotation(10f);
                

                这篇关于LibGDX - 围绕它们的中心旋转一个 2d 精灵数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:加载 TextureAtlas 的状态 下一篇:LibGDX - 如何让我的菜单屏幕切换到游戏屏幕?

                相关文章

                最新文章

                <legend id='0BmqZ'><style id='0BmqZ'><dir id='0BmqZ'><q id='0BmqZ'></q></dir></style></legend>

                  <small id='0BmqZ'></small><noframes id='0BmqZ'>

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

                    <tfoot id='0BmqZ'></tfoot>