Tutorial 6: Creating wearable Objects for personal protective equipment
Hi, once again it may happen in VR trainings that the user has to put on their personal protective equipment beforehand. For this purpose, we have implemented the Wearable Actor under Helpers. Start the URealXR plugin and go to the Tool Spawner. Under Helpers, click the button labeled "Wearable".

By default, the BP has no actor assigned. To set this up, first download the 3D model of a helmet from the following link.

Import the 3D model by clicking on Import and navigating to the folder where you downloaded the helmet. Click on "open". Make sure that you are in the right
Beforehand, please make sure that you are in the Content Browser and inside the desired folder where the new 3D model should be stored.

Click on "import all"

Now select the helmet in the Content Browser and then click on the Wearable actor in the Outliner.

Now direct your attention to the Details panel. Under Mesh, click the left arrow to assign the current selection in the Content Browser to the actor.

The Head Range parameter defines how close you need to bring the helmet towards the head for it to be automatically equipped. A value of 20 serves as a good baseline for smaller objects.

The Auto Hide parameter makes the helmet automatically disappear when it is within the defined radius.

To activate the functionality of the wearable, you must finally create a Tasklist as usual, with one section and a task inside it. The parameters for this should look as follows:
If you are not yet familiar with creating a Task List, please take a look at the introduction tutorial.
https://xrmacher.gitbook.io/urealxr-docs/d.-your-first-vr-application

When you now grab the helmet in VR and bring it towards your head, the task will be automatically completed and registered as equipped, depending on the set distance.
If you would like a visual representation of the helmet on your virtual head after putting it on, please follow the instructions below.
Navigate to the folder Content\VRAssembling\Blueprints\Game and double-click the BP_MotionControllerPawn Blueprint.

As a first step, switch to the Viewport view.

In the next step, select the Camera under Components.

Now click the Add button and add a Static Mesh.

The result should look as follows:

Now select the 3D model of the helmet in the Content Browser and assign it to the Static Mesh via the Details panel.

Now move the helmet in the Viewport as shown.

With the Static Mesh Actor still selected under Components, go to the right side of the Details panel. There, locate the entry Visible and set it to Off. The helmet should now disapear in the viewport.

In the next step, switch to the Event Graph by double-clicking on the text. Find a free space here where we can create a programming sequence.

Right-click on an empty area and type “Custom Event”. Then select the suggestion “Add Custom Event”.

Give the event a name.

We now want to change the visibility of the helmet when this event is triggered. To do this, drag the Static Mesh Actor from the left side under Components into the Event Graph.

Now drag out a node from the Static Mesh Actor called “Set Visibility”.

Connect the execution pin from the event to the new node. Make sure that a checkmark is set at “New Visibility”.

When this function is now called, the helmet will be displayed. In the next step, we still need to connect the logic with the Task List Editor.
In the next steps, we will create a Blueprint that can communicate with this event. To do this, create a new Blueprint named BP_HandleCommunication under VRAssembling/Blueprints/Special, or in a folder of your choice. Open the created BP by double clicking on it.

To enable this blueprint to communicate with the Tasklist Editor, we first need to add an interface class.
Do this by clicking on Class Settings (top row), then go to the Details panel and click on the Add dropdown under Implemented Interfaces.

The interface we want to add is called BI_AssemblyEvent.
Type this name into the search field and click on it to add it.

You have now successfully added the interface.
Next, click Compile and Save.

Now switch to the Event Graph view and focus on the left side.
There, under "Interfaces", you will see the Custom Assembly Event.
Double-click on it to bring the event into the Event Graph.

In the next step, drag off from the Info pin and create a "Switch on String" node.
Then connect the execution pin from the event to the input of the switch node.

Next, click on the Switch on String node and turn your attention to the Details panel.
Click the plus icon next to "Pin Names", and add a new pin with the name "HelmetOn".

From the HelmetOn execution pin, drag out a "Get all actors of class" node
The result should look as follows:

Unter actor class wählen wir den BP_MotioncontrollerPawn aus

From the Get All Actors of Class node, drag from the Out Actors pin to create a For Each Loop node.

The result should look as follows:

Through this sequence of nodes, we now have access to the VR Pawn and its functions. From the last node, drag from the Array Element pin to create the ShowHat node.

Finally, connect the execution pin from the second-to-last node to the last node.

Save the Blueprint and close it. Now drag the created BP file into the Viewport. Make sure via the outliner that you have selected the bp.

Now switch to the Task List Editor and open the task where we assign the wearable.
Click on the plus sign next to Event and fill in the information as follows:

In the final step, click the blue arrow to assign the Blueprint we created to the event.

What happens now: when the user is prompted to put on the helmet, it will automatically be hidden by the wearable function. At the same time, the step is registered as completed. Afterwards, the event that executes our created Blueprint is automatically triggered. This references the BP_MotionControllerPawn, which uses our custom event to make the correctly positioned helmet visible on the player’s head.
Last updated