我在 TransformGroup 中有一个场景,允许鼠标缩放/旋转/平移。
我需要将相机位置设置得足够远,以便可以看到整个场景,我使用以下代码执行此操作:
// Position the position from which the user is viewing the scene
ViewingPlatform viewPlatform = universe.getViewingPlatform();
TransformGroup viewTransform = viewPlatform.getViewPlatformTransform();
Transform3D t3d = new Transform3D();
viewTransform.getTransform(t3d);
t3d.lookAt(new Point3d(0,0,50), new Point3d(0,0,0), new Vector3d(0,1,0));
t3d.invert();
viewTransform.setTransform(t3d);
执行上述代码的工作原理是我可以用鼠标操纵场景。但是,如果我换掉这一行:
t3d.lookAt(new Point3d(0,0,50), new Point3d(0,0,0), new Vector3d(0,1,0));
和:
// Change value from 50 to 90 to push the camera back further
t3d.lookAt(new Point3d(0,0,90), new Point3d(0,0,0), new Vector3d(0,1,0));
我失去了用鼠标操作屏幕的能力。
如何在将相机进一步向后推的同时保持鼠标变形的能力,以便我可以查看整个屏幕?
非常感谢提前!