Fologram Docs

State

Fologram keeps track of what users are doing in mixed reality using a property called State.

Pointer State

To get a pointers current state, use the Get Pointer object to retrieve all currently tracked pointers, then use the Deconstruct Pointer component to get the current state of the pointer. See the article on Getting Events for a list of all possible pointer states.

Button State

To get the state of a geometry button, use the OnHover, OnTap or OnToggle components. Each of these components will output an Enabled boolean indicating the button’s state.

State Gate

The state property is commonly used to enable and disable groups of components in a grasshopper definition using the State Gate component. The State Gate takes a single string as an input and allows for a variable number of output parameters with user-defined strings that match expected input values. Outputs are connected to groups rather than input parameters. When an input to the state gate matches the name of an output, the group connected to that output are enabled and all other groups are disabled. The following are some common patterns for using the state gate.

1. Using the State Gate with a boolean input

 
The state gate can be used to switch between two different application modes using a simple boolean input. For instance, to create an application that allows users to switch between near touch interaction and hand-ray interaction, you could create two groups of components that define these two functionalities, and connect them to a state gate as above.
💡
Use Global Variables to pass data between isolated groups in your grasshopper definition.

2. Using the State Gate with a state strings

The state gate can also be used to update parts of your definition when a detected pointer matches a given state. To achieve this, we rename the outputs of the state gate to match the expected input strings. Take the following application as an example:
  1. When a user starts dragging (DragStart state), start drawing a new curve
  1. While a user is dragging (Drag state), add points to the curve
  1. When the user finishes dragging (DragStop state), add the curve to a list
We would rename our state gate as follows: