osgGA::KeySwitchMatrixManipulator 漫游切换器
//演示申请键盘操作切换操作器
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keySwitch = new osgGA::KeySwitchMatrixManipulator;
osgGA::KeySwitchMatrixManipulator* keyswitchManipulator;
keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator('1', "Trackball",
new osgGA::TrackballManipulator);
keyswitchManipulator->addMatrixManipulator('2', "Flight",
new osgGA::FlightManipulator);
keyswitchManipulator->addMatrixManipulator('3', "Drive",
new osgGA::DriveManipulator);
keyswitchManipulator->addMatrixManipulator('4', "Terrain",
new osgGA::TerrainManipulator);
注意:默认使用的是按代码执行顺序第一个漫游器 keyswitchManipulator->addMatrixManipulator('1', "Trackball",
new osgGA::TrackballManipulator);,所以当你想要实现启动第一个漫游器的时候,请注意代码顺序。
禁止转载