STYLY for Vision Pro: Rotate and move the grabbed object by fixing its axis

This time, we will introduce how to fix the rotation and movement of objects grabbed in STYLY for Vision Pro.

Move with axis constraint

Rotate with axis constraint

Move with Axis Constraint

Prepare an object with XRGrabInteractable attached.

This time, we will use a Cube.

Image2

We will allow movement along only the X-axis.

Check all boxes in Rigidbody’s Freeze Rotation. Then, check Freeze Position for all axes except the one you want to move.

Then, check Is Kinematic. Since we want it to float in the air, we unchecked Use Gravity.

Image4

Execute.

 

Rotate with Axis Constraint

Similarly, prepare an object with XR Grab Interactable attached.

This time, we will allow rotation only on the X-axis.

Check all boxes in Rigidbody’s Freeze Position. Then, check Freeze Rotation for all axes except the one you want to rotate.

Then, check Is Kinematic. Since we want it to float in the air, we unchecked Use Gravity.

Image1

In the example, we implemented it by rotating the Inspector’s Rotation by 45 degrees.

Execute.

We have introduced how to fix the rotation and movement of grabbed objects.