Determine the Grab Attach Point

addam davis
3 min readMay 15, 2024

Objective: control where the XR Origin attaches to grabbable objects!

What are attach transforms? An attach transform is a child object that specifies where on the XR Origin controller can grab an object. It’s used in the XR Grab Interactable component, this allows the player to interact with objects in your XR space.

If you have followed along with me through the VR tutorials you will notice when your grab an object the hand goes into the center of the object. This is because if we look at the object, in my case it’s a basketball, its origin is in the center of the basketball. By default, the grab interactive toolkit will snap the object’s origin to the player’s hand.

If we select the grabbable object(basketball) and in the inspector, under the XR Grab Interactable script we will see a few options.

Attach Transform — The attachment point Unity uses on this Interactable (will use this object’s position if none is set).

Secondary Attach Transform — to use on this interactable for multi-hand interaction (will use the second interactor’s attach transform if none is set).

Use Dynamic Attach — Enable to make the effective attachment point based on the pose of the interactor when the selection is made.

Attach Ease In Time — Time in seconds to ease in the attach when selected (a value of 0 indicates no easing).

Attach Point Compatibility Mode —Use default for consistent attach points between all movement type values. use Legacy for older projects that want to maintain the incorrect method which was partially based on center of mass.

Since I am currently working with a basketball the simplest solution for this problem would be to use Dynamic Attach. When you select this, you will have more options available to you.

Match Position — Match the Position of the Interactor’s attachment point when initializing the grab. This will override the position of Attach Transform.

Match Rotation —Match the rotation of the Interactor’s attachment point when initializing the grab. This will override the rotation of Attach Transform.

Snap To Collider Volume —Adjust the dynamic attachment point to keep it on or inside the Colliders that make up the object.

Reinitialize Every Single Grab — Re-initialize the dynamic pose when changing from multiple grabs back to a single grab.

If we were picking up something that needed to be held in a certain way, i.e. a pencil, then we would want to use an Attach Transform. Since I am using a basketball all I needed was the Dynamic Attach. Now when we load into our VR space and grab the ball our hand will now be attached to the outside of the object!

Don’t be afraid to experiment with your grabbable objects and I’ll see you in the next tutorial!

--

--