STYLY for Vision Pro: How to snap and move objects

This time, we introduce how to snap and place an object that you are holding.

Snapping refers to automatically locking the position and rotation of an object when it enters a predefined range.

Setting Up the Board for Placement

Generate a Plane and a Cube. Rename the Plane to “BasePanel” and the Cube to “BasePoint.”

Image8

The Plane acts as a visible base, while the Cube serves as the trigger and position setting for snapping the object.

Set the Transform of the BasePanel and BasePoint as follows:

Image1
Image7

Add the “XR Socket Interactor” component to BasePoint from Add Component.

Image5

Enable the “Hover Socket Snapping” option in BasePoint’s “XR Socket Interactor” settings. This allows the object to automatically snap into position when it enters the snap range while being held.

Image9

Check the “Is Trigger” option in BasePoint’s Collider settings.

Image2

Uncheck the “Mesh Renderer” option.

Image10

Setting Up the Object to Be Placed

Generate a Cube and rename it to “SnapBlock.” Set its Transform as follows:

Image6

Add the “XR Grab Interactable” component from Add Component.

Image4

To prevent the SnapBlock from floating or rotating, disable “Use Gravity” and enable “Is Kinematic” in its Rigidbody settings.

Image3

Execution

This time, we introduced how to snap objects.