|
如题,我连接了另一个设备,比如说是个joystick,想让它和鼠标一起控制当前camera。
可当我这么写时,Trackball 和 joy 两种manipulator在切换的时刻貌似会重置场景(切换后工作正常),就像是按了空格一样。。。怎么办,有办法保持之前的场景么?求高手释疑。- osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keySwitchManipulator = new osgGA::KeySwitchMatrixManipulator;
- keySwitchManipulator->addMatrixManipulator('1', "Trackball", new osgGA::TrackballManipulator);
- keySwitchManipulator->addMatrixManipulator('2', "3D", new joyManipulator);
-
- osgViewer::Viewer viewer;
- viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
- viewer.setCameraManipulator(keySwitchManipulator.get());
复制代码 |
|