使用 KeyNavigatorBehavior 时,哪些键用于移动?我该如何设置它们?
Which Keys are used to move while using KeyNavigatorBehavior? How do I set them?
我了解了一些有关 Java3D 的知识,我想知道如何使用击键在相机中移动。我找到了 KeyNavigatorBehavior 并进行了设置,只是没有 Key 做任何事情。如何正确使用此行为?
这里我得到了设置行为的方法:
protected BranchGroup buildViewBranch(Canvas3D c) {
BranchGroup viewBranch = new BranchGroup();
Transform3D viewXfm = new Transform3D();
viewXfm.set(new Vector3f(0.0f, 0.0f, 10.0f));
TransformGroup viewXfmGroup = new TransformGroup(viewXfm);
viewXfmGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
viewXfmGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
BoundingSphere movingBounds = new BoundingSphere(new Point3d(0.0, 0.0,0.0), 100.0);
BoundingLeaf boundLeaf = new BoundingLeaf(movingBounds);
ViewPlatform myViewPlatform = new ViewPlatform();
viewXfmGroup.addChild(boundLeaf);
PhysicalBody myBody = new PhysicalBody();
PhysicalEnvironment myEnvironment = new PhysicalEnvironment();
viewXfmGroup.addChild(myViewPlatform);
viewBranch.addChild(viewXfmGroup);
View myView = new View();
myView.addCanvas3D(c);
myView.attachViewPlatform(myViewPlatform);
myView.setPhysicalBody(myBody);
myView.setPhysicalEnvironment(myEnvironment);
KeyNavigatorBehavior keyNav = new KeyNavigatorBehavior(viewXfmGroup);
keyNav.setSchedulingBounds(movingBounds);
viewBranch.addChild(keyNav);
return viewBranch;
}
以下是设置 VirtualUniverse 的行:
group = new BranchGroup();
VirtualUniverse universe = new VirtualUniverse();
Locale locale = new Locale(universe);
locale.addBranchGraph(this.buildViewBranch(canvas));
locale.addBranchGraph(group);
我自己找到了答案:
您必须激活 KeyboardMouse (Alt + Shift + Num) 并停用 numlock :
键是:箭头 + 页面 up/down(也在 numlock 上)
我了解了一些有关 Java3D 的知识,我想知道如何使用击键在相机中移动。我找到了 KeyNavigatorBehavior 并进行了设置,只是没有 Key 做任何事情。如何正确使用此行为?
这里我得到了设置行为的方法:
protected BranchGroup buildViewBranch(Canvas3D c) {
BranchGroup viewBranch = new BranchGroup();
Transform3D viewXfm = new Transform3D();
viewXfm.set(new Vector3f(0.0f, 0.0f, 10.0f));
TransformGroup viewXfmGroup = new TransformGroup(viewXfm);
viewXfmGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
viewXfmGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
BoundingSphere movingBounds = new BoundingSphere(new Point3d(0.0, 0.0,0.0), 100.0);
BoundingLeaf boundLeaf = new BoundingLeaf(movingBounds);
ViewPlatform myViewPlatform = new ViewPlatform();
viewXfmGroup.addChild(boundLeaf);
PhysicalBody myBody = new PhysicalBody();
PhysicalEnvironment myEnvironment = new PhysicalEnvironment();
viewXfmGroup.addChild(myViewPlatform);
viewBranch.addChild(viewXfmGroup);
View myView = new View();
myView.addCanvas3D(c);
myView.attachViewPlatform(myViewPlatform);
myView.setPhysicalBody(myBody);
myView.setPhysicalEnvironment(myEnvironment);
KeyNavigatorBehavior keyNav = new KeyNavigatorBehavior(viewXfmGroup);
keyNav.setSchedulingBounds(movingBounds);
viewBranch.addChild(keyNav);
return viewBranch;
}
以下是设置 VirtualUniverse 的行:
group = new BranchGroup();
VirtualUniverse universe = new VirtualUniverse();
Locale locale = new Locale(universe);
locale.addBranchGraph(this.buildViewBranch(canvas));
locale.addBranchGraph(group);
我自己找到了答案:
您必须激活 KeyboardMouse (Alt + Shift + Num) 并停用 numlock :
键是:箭头 + 页面 up/down(也在 numlock 上)