0

如何更改测试平台世界输出的坐标系?谢谢。

http://postimg.org/image/71d6fner5/

http://postimg.org/image/upx9oo0oh/

我决定了这个问题。

我重写 DebugDraw 并在构造函数中将 YFlip 设置为 false。

viewportTransform.setYFlip(false);

public class EnginePanelJ2D extends JPanel implements TestbedPanel {
    // (other code from org.jbox2d.testbed.framework.j2d.TestPanelJ2D)
    public EnginePanelJ2D(TestbedModel argModel) {
        draw = new EngineDebugDraw(this);
        // other code
    }
}

EngineDebugDraw

public class EngineDebugDraw extends DebugDraw {
    // (other code from org.jbox2d.testbed.framework.j2d.DebugDrawJ2D)
    public EngineDebugDraw(EnginePanelJ2D argTestPanel) {
        // other code
        viewportTransform.setYFlip(false);
    }
}

就这样

4

1 回答 1

0

您可以通过弄乱视口变换的矩阵来更改有关视口的所有内容。这就是它在那里的原因。例如,使用 Mat22.createRotationMatrix (或类似的东西),然后执行 viewportTransform.mulBy(Mat22.createRotationMatrix(__)) 如果你想旋转视口。您也可以对其进行转换等。

于 2013-11-24T19:11:33.917 回答