Tutorial 3: How do I create a real-time interaction between a Lever (Turnable) and another object?
In this tutorial, our goal is to create an interactive lever. When operated, this lever will move a platform. The movement of the lever should be directly linked to the movement of the platform.
To set this up, please create a new project or level. Make sure the project is created using the URealXR template.

Open the URealXR interface and drag a Lever (Turnable) into the scene.

In the first step, we want to replace the 3D model to better represent a lever.
To do this, please focus on the Details panel while the Lever (Turnable) is selected.
Under Settings > Mesh / Mesh, click on the folder icon to jump to the folder where the currently assigned 3D model is located.

In the Content Browser, search for the 3D model named SM_Lever_Test.

Select it, and then return your attention to the Details panel.
By clicking the Assign button, the 3D model selected in the Content Browser will be assigned to the Lever (Turnable). You should now see the 3D model in the viewport.

Position the lever so that it can be easily reached during the interaction.

The new 3D model we added to the lever has a different rotation compared to the previous one. We will adjust this in the next step.
Select the Lever, and focus your attention on the Details panel. Under Settings > Mesh, open the section Mesh Pivot Transform and set the rotation to the following values:

The lever is now aligned neutrally. In the viewport, you will see a diamond-shaped symbol labeled Hand Offset. This indicates where the lever can be grabbed in VR.
To adjust it, go to the Details panel, under the section Settings > Hand, and open the Hand Offset category. There, modify the X, Y, and Z values so that the gizmo aligns with the handle of the lever.

Next, we want to set the Hand Range. This determines the distance at which the hand is detected.
Feel free to set this value generously, as a larger range makes handling in VR easier.

In the next step, we want to configure the rotation angle of the lever.
To do this, go to the Details panel, scroll to the top, and open the section Settings > Angles.
There you will find two relevant values:
Min Angle is used when the rotation should go into the negative direction from the initial point.
Max Angle defines the positive rotation range relative to the initial position.
How do I determine which parameter I need to modify?
In this example, we want the lever to rotate 90 degrees upward. To find out whether you need to use Min Angle or Max Angle, proceed as follows:
Select the Lever (Turnable) in the scene.
In the Viewport, manually rotate the lever upward using the rotation tool and observe the rotation value (press 'E' to activate it).
Observe the direction in which the lever rotates relative to its starting point:
If the lever rotates in the positive direction, you’ll need to set the Max Angle.
If the lever rotates in the negative direction, you’ll need to set the Min Angle.
Reset the lever back to its original rotation afterward.
Now apply the appropriate value (e.g., Min Angle = -90) to achieve the desired movement range.

Now that we have successfully configured the lever, the next step is to use it to move another object. To achieve this, we need the Axis Mover, which can be found under the Helpers category.

After bringing the Axis Mover into the scene by clicking the button, let’s take a closer look at it. Make sure it is selected, and then turn your attention to the Details panel.
Under Settings, you will find two important parameters:
Distance: Defines how far the object should move.
Start Percent: Defines the starting point of the movement, expressed as a percentage of the total distance.

If you set the Distance to 50, you will see that this distance is also visually displayed in the viewport.
Rotate the Axis Mover in the viewport so that the visual representation of the distance is oriented upward.

Now that we’ve defined the parameters for how we want to move an object, the next step is to assign an object to the Axis Mover that it should control.
To do this, navigate to the Content folder under VRAssembly/Meshes and select the gear mesh.Place the selected gear mesh into the scene.

Now comes the most important part:
To connect the gear with the Axis Mover, you must set its Mobility to "Moveable" in the Details panel first.

Then, right-click on the gear and select "Attach To...".
Next, click on the eyedropper icon, and then use it to click on the Axis Mover in the scene to attach the gear to it.

If everything worked correctly, the gear should now appear as a child object of the PB_AxisMover in the Outliner.

In the final step, we need to create the link between the lever and the Axis Mover.
To do this, select the lever, and in the Details panel, look for the entry called "Progress Handlers".

Click on the plus icon to add a new entry, then use the eyedropper tool to select the Axis Mover in the scene. The final result should look as follows.

Congratulations! You have now successfully created an interaction.
Before you can test this interaction in VR, you need to activate the Lever (Turnable) using the Tasklist Editor.
To do this, follow these steps:
Create a new tasklist and give it a name.
In the new list, create a section that contains a task.
Assign the Turnable Actor to the task.
It should look like this:

Save your progress an try it out in VR
Last updated