Home / Language / English / Mouse and Keyboard Navigation in 3D

Mouse and Keyboard Navigation in 3D

How to add mouse and Keyboard navigation in java3D virtual world:

private void addMouseNav() {
TransformGroup transformgroup = universe.getViewingPlatform().getViewPlatformTransform();
//translation mouse (right)
MouseTranslate myMouseTranslate = new MouseTranslate(MouseBehavior.INVERT_INPUT);
myMouseTranslate.setTransformGroup(transformgroup);
myMouseTranslate.setSchedulingBounds(bounds);
sceneBG.addChild(myMouseTranslate);
//zooming with mouse (Alt + Left)
MouseZoom myMouseZoom = new MouseZoom(MouseBehavior.INVERT_INPUT);
myMouseZoom.setTransformGroup(transformgroup);
myMouseZoom.setSchedulingBounds(bounds);
sceneBG.addChild(myMouseZoom);
// rotation mouse (left)
MouseRotate myMouseRotate = new MouseRotate(MouseBehavior.INVERT_INPUT);
myMouseRotate.setTransformGroup(transformgroup);
myMouseRotate.setSchedulingBounds(bounds);
sceneBG.addChild(myMouseRotate);
}

private void addKeyboardNav() {
TransformGroup transformgroup = universe.getViewingPlatform().getViewPlatformTransform();
KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(transformgroup);
keyNavBeh.setSchedulingBounds(bounds);
sceneBG.addChild(keyNavBeh);
}

About Mohammad Khazab

این را هم ببینید

Gliffy – Online Diagram Software and Flowchart Software

http://www.gliffy.com Related

Leave a Reply