By default, the haptics device tracker can only interact with the outermost surface that it comes in contact with. That means for example, if there is a model of a hand with a bone enclosed in flesh, we would only be able to feel the outermost shape (flesh) and not the one inside (bone). The HapticLayeredGroup makes it possible to feel multiple layers of haptics, even if they are enclosed.
<!!-- hapticLayers.x3d --> <Group> <GlobalSettings> <HapticsOptions maxDistance="1" /> </GlobalSettings>
Here we set the maxDistance of HapticsOptions to one so that haptics is rendered when the tracker is 1m away from the object. Here, HapticsOptions is a child of the bindable node GlobalSettings, which is responsible for the default settings of an H3D program.
<!!-- hapticLayers.x3d --> <HapticLayeredGroup> <Shape> <Appearance> <Material/> <ImageTexture url="box_texture.png"/> <SmoothSurface stiffness="0.08" /> </Appearance> <Box size="0.1 0.1 0.1"/> </Shape> <Shape> <Appearance> <Material/> <FrictionalSurface stiffness="0.3" /> </Appearance> <Sphere radius="0.03"/> </Shape> </HapticLayeredGroup> </Group>
As can be seen, the HapticLayeredGroup functions just like any other X3DGroupingNode, with the special property that the haptics of all HapticLayeredGroup children can be felt. In this example, the Sphere resides inside the Box. When probing, the user will first feel the Box and if the user pushes the probe further in he would be able to feel the Sphere.