User`s guide
Working with VRML Sensors
3-23
Sensors Description
VisibilitySensor Detects visibility changes of a rectangular box as you navigate the
world.
Interactive Mode
Interactive mode allows clients to modify a remote virtual world via events from sensor
nodes defined in the virtual world. Interactive mode is useful when a virtual world
includes a sensor.
Interactive mode is disabled by default on clients. You can enable (or later disable)
interactive mode on a client via context menu in the Web Viewer or by pressing the I key
shortcut.
You can disable interactive mode for a particular virtual world on the host computer. For
details, see the ClientUpdates property, using vrworld/get or vrworld/set.
Read VRML Sensor Values
To read a value of a readable VRML field (either exposedField or eventOut), first
synchronize that field with the vrnode/sync method. After synchronization, each time
the field changes in the scene, the field value updates on the host. You can then read the
value of the field with the vrnode/getfield method or directly access the field value
using the dot notation.
Reading VRML Sensor Values Example
The virtual scene for the Magnetic Levitation Model example, maglev.wrl, contains a
PlaneSensor (with the DEF name 'Grab_Sensor'). The PlaneSensor is attached to the
ball geometry to register your attempts to move the ball up or down when grabbing it
using the mouse. The example uses the sensor fields minPosition and maxPosition to
restrict movement in other directions. You can use the output of the sensor translation
field as the new setpoint for the ball position controller. You can read the sensor output
value into a MATLAB variable setpoint with the following:
% create the vrworld object and open the world
wh = vrworld('maglev.wrl');
open(wh);
% get the node handle