Health and Safety Recommendation: While building mixed reality experiences, we highly recommend evaluating your content to offer your users a comfortable and safe experience. Please refer to the Health and Safety and Design guidelines before designing and developing your app.
This is a basic tutorial that lets you recreate the Ball Throwing Scene sample. In this tutorial you will reuse the project created in Basic Passthrough Tutorial. If you haven’t done that yet, please do it first.
Before You Begin
In your headset, navigate to Settings > Physical Space > Space Setup > Set Up to capture scene.
1. Setup Input Action Mappings
Open Edit > Project Settings > (in Engine section) > Input.
Add a new Action Mappings for “spawn_trigger” mapping to “Oculus Touch (R) Trigger”.
2. Create a New Blueprint Class for the Ball
Navigate to Content Browser, right-click and select Blueprint Class.
In the pop-up window, select Actor.
Name it “Ball_BP” and open it.
In the components window, click on Add Component and select Static Mesh.
In the Details panel, set the Static Mesh to a Sphere ,set Transform > Scale to (0.2,0.2,0.2), apply a material of your choice and enable Simulate Physics.
3. Create a New Blueprint Class for the Pawn
Navigate back to the Content Browser, right-click and select Blueprint Class.
In the pop-up window, select Pawn.
Name it Pawn_BP and open it.
In the components window, click on Add Component and select Camera.
In the components window, click on Add Component and select Scene.
In the components window, click on Add Component and select MotionController.
Setup Event Graph as below :
4. Add Pawn_BP into the Scene
Close all Blueprints and return to the main editor window.
Drag Pawn_BP into the scene.
Select Pawn_BP and in the Details panel, set Location to (0,0,0), Auto Possess Player to Player 0, AI Controller Class to PlayerController and Auto Receive Input to Player 0.
Delete existing Cameras from the scene.
5. Import Scene Entity Meshes
Download Materials, Meshes and Textures, from Scene Sample.
Copy and paste them into project’s Content folder in file explorer.
6. Add the “Oculus XRScene Actor” to the Scene
Search Oculus XRScene Actor in Place Actors panel and drag it into your scene.
Select OculusXRSceneActor in the scene, in the Details panel, and set Scene Actor as below:
7. Add Scene Support
Open Edit > Project Settings > (in Plugins section) > Meta XR.
Enable Anchor Support, Scene Support and Passthrough Enabled.
8. Build and Test
Save project.
Under platforms click Meta Quest device. Unreal will deploy and run APK on the device.
Pull your right controller’s trigger in the game to place balls into the scene.