Toggle group


Jump to: navigation, search

The ToggleGroup node allows users enable or disable the graphics and/or haptics rendering of its children nodes. It contains the fields graphicsOn and hapticsOn for this purpose.

Learning objective:

  • Using the ToggleGroup node

  <ToggleGroup DEF="T">
        <Material diffuseColor="0.5 0.7 0" />
        <FrictionalSurface />
      <Box size="0.1 0.1 0.05"/>
  <MouseSensor DEF="M" />
  <ROUTE fromNode="M" fromField="rightButton" toNode="T" toField="hapticsOn" />
  <ROUTE fromNode="M" fromField="leftButton" toNode="T" toField="graphicsOn" />

In the example above, we enclose our shape in a ToggleGroup. We also add a MouseSensor to the scene. rightButton is routed to hapticsOn, while leftButton is routed to graphicsOn. Now when the left mouse button is clicked, the shape is rendered, when the right button is clicked the haptics of the geometry is rendered.


Personal tools
go to