Programming wand buttons

Discussion in 'Technical support' started by goreckibdg, Aug 29, 2016.

  1. goreckibdg New Member

    I would like to ask how to program wand buttons in Quazar to create simple interaction with objects like enable/disable lights or open/close doors? Is it possible to do all of this by using flowgraph?
  2. michal.twardowski Moderator

    First, the wand should be visible as a device of type VRPN Button in the Controls -> Devices tab of the Quazar3D Immersive Manager. Make sure that this is working and that as you press wand buttons you can see it in the Controls -> Devices tab. Then within the Controls tab, switch to the Control state trigger section ( at the bottom of the window ). Now choose the ‘Add control state trigger’ button. You will see that the control state trigger has been inserted. Choose the right device in the first combo box ( wand button device ), set the number of the button that you want to use. In the end, from the second checkbox choose the control state that you will use in your application. Just make sure that the control state that you choose is not in the conflict state with any previously added control state triggers. Now whenever you press the choosen wand button the control state will be changed and sent to the application and you should also see the log message about control state change in the console at the bottom of the Quazar3D Immersive Manager.

    Inside the application you check the control state in the following way:
    Int engine.controls.getState(int state);
    As a state parameter you can pass an integer or you can use engine defines such as CONTROLS_STATE_FORWARD, CONTROLS_STATE_BACKWARD, etc.

    For more information please refer to the script manual ( where you can find the documentation of other engine.controls.* functions ) and scripts from the cave template ( eg CaveLaser.QSF where this method is used to change the color of the cave laser upon the press of one of the wands buttons).

Share This Page