1

I inherited a decent-sized code base that has a subpar camera control scheme. I'd like to use WASD for controls, but W is for wireframe and S is for statistics. The only solution I could find was:

viewer.setKeyEventSetsDone(0); 

But this doesn't work (or I have it in the wrong place).

What's the easiest way to accomplish disabling wireframe and statistics? (Or even better remapping them)

user3000724
  • 651
  • 3
  • 11
  • 22

2 Answers2

2

The objects that consume the W and S events are two "events handlers", in particular:

  • StatsHandler, for which you can set the toggle key with this method
  • StateSetManipulator, refer to this method

Check your code base, you will see them attached to the main osg viewer or one of its views.

rickyviking
  • 846
  • 6
  • 17
  • 1
    This led me to the answer. They were calling a (new StatsHandler) under viewer->addEvent(). I created an osgviewer::StatsHander *sh = new osgviewer::StatsHandler, then called sh->setKeyEventTogglesOnScreenStats('p') and modified viewer->addEvent(sh);. Worked great! – user3000724 Apr 03 '17 at 15:44
0

Heres the answer well formated

osgViewer::StatsHandler *sh = new osgViewer::StatsHandler;
sh->setKeyEventTogglesOnScreenStats('p');
osggl->addEventHandler(sh);
superbem
  • 441
  • 3
  • 10