you can change everything about the viewport by messing with the matrix of the viewport transform. That's why it's there. For example, use the Mat22.createRotationMatrix (or something like that), and then do viewportTransform.mulBy(Mat22.createRotationMatrix(__)) if you want to rotate the viewport. Also you can transform it, etc.
JBox2d testbed rotate the world
-
04-08-2022 - |
Question
how can i change the coordinate system of the testbed world output? Thanks.
http://postimg.org/image/71d6fner5/
http://postimg.org/image/upx9oo0oh/
I decided the question.
I'am override DebugDraw and set YFlip to false in constructor.
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);
}
}
thats all
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow