SixDOFMouseSensor

  1. Running this demo
  2. Laserpointer and SixDOFMouseSensor in VRML

Running this demo

This turorial explains how to integrate a SixDOFSensor into a VRML world, by using the native node SixDOFMouseSensor. This demo uses the SensorSimSrv component from the user_centric_proj tutorial. It should be in the bin folder of the OAW root folder. So you may start the demo of this tutorial by executing the components on a console in the wrl_sixdofmousesensor folder like follows:
		console1>glutCyberleSrv -inifile gsrv.ini
		console2>SensorSimSrv -no_headmove
		console3>OAWMaster master.ini
	
Because for this tutorial only the motion of the sixdofmousesensor is important, the SensorSimSrv component is started with the option "-no_headmove".
If you run this demo you'll see the two spheres like in the VRML file from the maltepointer tutorial. But this time there is a virtual laserbeam that is controlled by the sixdofmousesensor node. The active instance and therefore the data of the sixdofmouse is provided by the SensorSimSrv component. The SensorSimSrv rotates the laserpointer on a cone.



Whenever the virtual laser beam hits the right sphere its color changes from blue to red that indicates that the group of the right sphere contains a touchsensor. Further you may notice, that if you navigate through the world the pointer will move with you. This is the basic idea of the SixDOFMouseSensor node: To integrate a sensor from the real world display set up into the virtual world. Rembember: Moving the viewpoint means moving the display system in the virtual world and therefore also all its sensors.
The implementation of the laserpointer is based on the same concepts as the pointer from the maltepointer tutorial. The source code for the needed scripts are located in the OAW-scripts section and the wrl PROTO can be found in the wrl-files/lib folder.

Laserpointer and SixDOFMouseSensor in VRML

The node definition of the SixDOFMouseSensor node is:
		SixDOFMouseSensor[
		eventOut SFVec3f posOut
		eventOut SFRotation rotOut
		eventOut SFInt32 buttonOut
		field MFString interface []
		]
	
From special interest is the field "interface". Here the name of the interface in the distributed simulation can be defined which this node will be connected to. Like can be seen from the sources of the SensorSimSrv component, it provides an interface of an SixDOFMouseSensor with the name "default_sixdofmouse". The integration of the laserpointer and its linking to the sensor "default_sixdofmouse" happens in the VRML file like follows:
		EXTERNPROTO Laserpointer[
		exposedField SFBool enabled
		exposedField SFInt32 mode       # 0 direct, 1 indirect manipulation
		exposedField SFVec3f transBias
		exposedField SFVec3f rotBias
		exposedField SFVec3f posOffset
		exposedField SFVec3f oriOffset
		eventIn SFBool  resetIn
		eventIn SFInt32 buttonIn
		eventIn SFVec3f posIn
		eventIn SFRotation rotIn
		]"../lib/laserpointer.wrl"

		DEF SIXDOFMOUSE SixDOFMouseSensor        {
		interface "default_sixdofmouse"
		}

		DEF LASER_POINTER Laserpointer {
		mode 0
		}

		ROUTE SIXDOFMOUSE.posOut     TO   LASER_POINTER.posIn
		ROUTE SIXDOFMOUSE.rotOut     TO   LASER_POINTER.rotIn
		ROUTE SIXDOFMOUSE.buttonOut  TO   LASER_POINTER.buttonIn
		ROUTE SIXDOFMOUSE.buttonOut  TO   APP_SCRIPT.sofButtonIn