3.4.5.  Tracking Support in Multipipe

SoXtMPRenderArea has an access method, SoTimerSensor* getTrackerSensor().

[Tip]

Getting a pointer to the sensor allows you to specify the time interval (by default set to 50Hz, i.e., 0.02 seconds), to customize the callback, and to schedule/unschedule the sensor triggers.

The ability to customize the sensor callback has been added because you might be using a custom input device. The default callback assumes that a one-button wand is used. There are a lot of input devices available on the market, with various numbers of buttons, joysticks, and other valuators. A custom callback allows you to take advantage of these various devices. Another reason for this customization is to allow you to use VR drivers other than trackd.

The default callback is provided by SoXtMPViewer . This callback, defaultTrackingCB, is defined at the viewer level rather than at the render area level, because the callback is likely to modify nodes from the scene graph (head position, wand position, scene position). These nodes are added by the viewer and are described below.

SoXtMPViewer adds a sub-graph for the wand in the same fashion as it adds a headlight group after the camera (during the setSceneGraph() call). This sub-graph contains the geometry, typically a line or cylinder, that represents the wand in the virtual world. It is possible to define an .iv file containing the geometry to use for the wand in the configuration file. The node is SoTracker SoTracker SoTracker , and the field to set is wandFile (SoSFString SoSFString SoSFString ). If the field wandFile is not set in the configuration file, the viewer uses the default geometry.

[Warning]

When using a custom geometry file, it is important that the wand be oriented towards the –z axis.

It is also possible to specify, in the application, a file to use instead of the default geometry. The meth od to use is setWandGeometryFile(SbString wandFile). The wand group, added to the scene graph by the viewer, is composed of an SoTransform SoTransform SoTransform node (wandTransform) and an SoSeparator SoSeparator SoSeparator node (default geometry or user-defined geometry). It is possible to access the wandTransform node with SoTransform* getWandTransform(). It is useful to access this node in order to modify the position and orientation of the wand according to the tracker data (in defaultTrackingCB).

SoXtMPViewer adds an SoTransform SoTransform SoTransform node (sceneTransform) just above the scene graph. This node is used to scale and to position the model in the immersive environment. By default, the model is positioned at the center of the first screen. The scale factor depends on the scene bounding box and on the field defaultObjectBoxMaxDim specifi ed in the configuration file (node SoTracker SoTracker SoTracker ). It is possible to access the sceneTransform node with the method SoTransform* getSceneTransform(). It is useful to access this node in order to modify the position and orientation of the scene according to the tracker data. (This is done in defaultTrackingCB).

SoXtMPExaminerViewer’span/spin/dolly camera behaviors have been modified. If the viewer is in immersive mode (i.e., an SoScreen SoScreen SoScreen is defined in the configuration file), these behaviors modify the sceneTransform node rather than the camera node. In immersive mode, the camera node is modified with tracker data (in defaultTrackingCB) from the head tracker.