STYLY for Vision Pro: How to Grab Objects

This time, we will introduce how to grab an object in STYLY for Vision Pro and trigger actions when grabbed.

Implementation Method

We will grab a Cube this time. The Cube’s name will be “SelectCube.”

Attach the XR Grab Interactable component to “SelectCube” from Add Component.

Image9

Also, attach a Script Machine to “SelectCube.”

Image1

*Note: Objects cannot be used without a collider. Please attach one if it’s not present.

Open the Interactable Events of XR Grab Interactable.

Image11

Press the + in the Select section and drag and drop SelectCube into the box.

Select Entered sends a signal to start processing when the object is grabbed.

Select Exit sends a signal to start processing when the object is released.

Image10

Press the No Function box and choose TriggerUnityEvent from the ScriptMachine section.

Image4

Give a name in the red frame section. This time, we named them StartSelect and ExitSelect.

Image2

Create a Script Graph. We named it “GrabTest.”

Image5
Image7

Press Edit Graph to open the Script Graph.

This time, we will change the color when the object is grabbed.

Add the following nodes:

  • UnityEvent
  • Renderer Get Material
  • Set Color

Enter the name you set in the Select section into the Unity Event.

Run the process.

Explanation of Sample Scenes with Grabbable Objects in STYLY

Grabable with Gravity and Grabable without Gravity

The difference between Grabable with Gravity and Grabable without Gravity is whether the RigidBody’s Use Gravity checkbox is checked or not.

Image12

Grabable with Gravity

Grabable without Gravity

Grabable and Scalable

Grabable and Scalable works by attaching the XR General Grab Transformer in addition to XR Grab Interactable.

Image3

Grabable and Scalable

Reactive Grabable can be implemented using the method introduced this time.

This time, we introduced how to create the grabbing functionality in STYLY For Vision Pro.