Made With Unity | Unity VR Part 6: XR Socket Interactor

Made With Unity | Unity VR Part 6: XR Socket Interactor

·

2 min read

XR Socket Interactor is used for holding interactable / items via a socket, a example will be use to wear a “Helmet” and a “ID Card” on your Player.

XR SOCKET INTERACTOR

On my scene I have two object: a “Helmet” and a “ID Card”.

Both object have the following Components: Collider, Rigidbody and the XR Grab Interactable script.

The “Helmet” object has two Interaction Layer Mask: Grab and Helmet. The Grab layer allows the object to be interactable by our hand when we pick it up, the Helmet layer will be to identify where it belong in the XR Socket Interactor, more on that later.

Same has the “Helmet” object, the “ID Card” object has two Interaction Layer Mask for the same reason.

On my XR Player, inside my Camera Offset, I have a empty game object named IDSocket with the XR Socket Interactor component and a Collider with the Is Trigger checked(where you want to place your object is the one that will have the XR Socket Interactor) and the Interaction Layer Mask ID.

Since I want to “wear” my “Helmet”, I put the HelmetSocket inside my Main Camera object and it will have the same component as the ID, the only difference will be on the Interaction Layer Mask that is going to be Helmet.

🎮PART 7 🎮