通常鼠標被鎖定到窗口並且不可見;以第一人稱射擊者的風格控制相機。從JMonkey窗口中解鎖鼠標
我的理解是,你從JMonkey窗口解鎖鼠標並使其可見通過調用
inputManager.setCursorVisible(true);
但是這沒有任何明顯的效果。這表現在下面的示例方案:
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
inputManager.setCursorVisible(true);
rootNode.attachChild(geom);
}
}
調用flyCam.setDragToRotate(true);
解鎖鼠標也引起許多DragToRotate行爲(unsurpisingly)
對於我的使用情況下,我需要,所以我需要它有時模式之間移動。這可能對其他情況有用 –
您可以動態地添加和刪除應用程序狀態,但是在您的情況下,根據需要啓用和禁用它可能會更好。 –