Skip to main content
Skip table of contents

Snap

A snap node requires a user to snap a specific object to a specific snap zone. For example this could be snapping a walkie talkie to a belt, or a tool to a toolbox, or even a permit to a worksite fence. We recommend all snappable objects start in an initial snapzone.

Snapping a tool to a Valve

Setup

Snap Node

To set up a snap zone requires three parts, the node in the graph as seen above, a snappable object, and a snap zone. Follow these steps to set up a new snappable object, snap zone and the snappable object node. that will progress the user in the graph when correct object is snapped at the required step.

Snap Zone Setup

A snap zone is the place the Snappable object will be placed.

  1. Start with an empty game object.

  2. Attach a “Guid Component” script.

  3. Attach a “Collider” Component that will define the bounds of the snapzone.

  4. Set the collider to a trigger.

  5. Attach the “Snap Zone Open XR” script.

    1. If you want this snapzone to only allow one object then set the Partnered Prefab reference to your object in your hierarchy.

  6. Attach the “Snapzone Middleman” script.

  7. Ensure the Snapzone Middleman has a unique ID Number


    it is best practice to show a user when they're close to Snapzone so that they understand when releasing an object will cause a snap. to achieve this we can use a highlighted version of the object that becomes visible only when the object is close to it.

Snap zone highlight setup

  1. Duplicate the object that will be snapped,

  2. apply the Snapzone material to this object

  3. child this object to our Snapzone object

  4. in the “Snap Zone Open XR” copy how the events are set up in the image below

    Snap Zone Open XR events to make a snapzone highlight be enabled when an object is close to it.

    Once complete the Snapzone should look like it is below.

A set up snap zone GameObject

Now we are ready to make the snappable object.

Snappable object set up

A snappable object is the object that will then be snapped to a snapzone.

  1. first follow the grabbable object setup tutorial, this is so we can grab the object

  2. Add the Snappable Object script.

  3. next add a Snappable Middleman Component. Ensure this ID is unique

    The Snappable Middleman Script

Once the Snap Zone and the Snappable Object are set up we can dive into the graph to link it all together

Snappable Node setup

  1. Open a graph.

  2. Right click and Create a new grab node (Steps → Grab).

  3. Reference the grabbable middleman on the step.

  4. In the Snapzone field add the Snapzone we made earlier.

  5. In the Snappable Object ID, be sure to reference the ID of the Snappable Object ID that we specified earlier.

A Filled in Snap On Zone Node

That's it. Now when a user is on the Snap step, when they grab the Snappable object and release it inside the Snapzone they will complete the step.

Grabbable Objects Starting in Snapzones

We recommend all grabbable object to start already in a snapzone. This makes it easier for a user to then decide to put an object back if not needed as well as the Lost Object component to work.

To make an object start in a snapzone follow these steps:

  1. Create your snappable object as mentioned above

  2. Create a snapzone as mentioned above

  3. Have the snappable object be placed in close proximity of the snapzone (As it will become snapped on play)

  4. On the Snap Zone Game Object find the “Snap Zone Open XR” script and set the partnered prefab to the object in the Hierarchy of what you want to start snapped.

  5. Set the current snapped Object to the same snappable object you want to start snapped.

Snap Zone Open XR Component


For more information on the other inputs and outputs found on this node see Steps

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.