【问题标题】:Make invisible body line box2d libgdx制作不可见的身体线条 box2d libgdx
【发布时间】:2017-11-19 19:21:53
【问题描述】:

我想让这些身体线条不可见,因为游戏中留下了很多东西,还有那个身体圆圈。正方形是图层平铺地图。 圆圈是精灵的身体。

Circle and Squares in game

【问题讨论】:

  • 您正在通过box2ddebugrendererstage debug renderer 绘制线条。停止绘制,让身体线条不可见

标签: java libgdx box2d


【解决方案1】:

您可以启用或禁用调试绘制 box2d 世界的不同部分。您可以在constructor 中设置此标志:

// create renderer with default values
Box2DDebugRenderer debugRenderer = Box2DDebugRenderer(
                      /*drawBodies*/         true,
                      /*drawJoints*/         true,
                      /*drawAABBs*/          false,
                      /*drawInactiveBodies*/ true,
                      /*drawVelocities*/     false,
                      /*drawContacts*/       true)

或只设置一个标志(例如drawBodies):

debugRenderer.setDrawBodies(false);

也请看full API reference

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-18
    • 1970-01-01
    • 2013-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多