MRUK) to load scene data, create invisible physics meshes on real-world surfaces, and spawn dynamic objects that collide with your walls, floor, and furniture.MRUKMixedRealitySample project in Android Studio. Build and deploy the sample to your Meta Quest device.| File / Scene | What it demonstrates | Key concepts |
|---|---|---|
Entry point that configures MRUK, Physics, and passthrough features | Feature registration, scene permission handling, procedural mesh spawning, passthrough enablement | |
Custom system that spawns basketballs on controller trigger press | Controller input detection, dynamic entity creation, physics configuration | |
Custom system that positions the UI panel in front of the user | PlayerBodyAttachmentSystem integration, HMD-relative positioning | |
Jetpack Compose UI with room setup and debug controls | Compose integration, scene.requestSceneCapture() invocation | |
Composition/Main.scene | Static scene entities: default floor, basketball mesh template, three target objects, UI panel | Meta Spatial Editor scene composition, static vs. dynamic entity pattern |
MRUKFeature to load your room’s spatial data from the device:mrukFeature.loadSceneFromDevice().whenComplete { result, ex ->
// Room data now available
}
MRUKSceneEventListener that destroys the default floor entity when a real room is detected. See MixedRealitySampleActivity.kt for the complete implementation. For more on MRUK scene management, see Scene understanding.AnchorProceduralMesh:val procMeshSpawner = AnchorProceduralMesh(mrukFeature, mapOf( MRUKLabel.FLOOR to AnchorProceduralMeshConfig(null, true), MRUKLabel.WALL_FACE to AnchorProceduralMeshConfig(null, true) // ... additional surface types ))
null for invisible meshes so passthrough shows through). The second parameter enables physics collision. See MixedRealitySampleActivity.kt for the complete surface type mapping. For more on procedural mesh generation, see MRUK reference.BallShooter system demonstrates how to create physics-enabled entities at runtime:val physics = Physics().apply {
shape = "sphere"; dimensions = Vector3(.12f, .12f, .12f)
state = PhysicsState.DYNAMIC; restitution = .99f
}
BallShooter.kt for the complete spawning logic. For more on physics configuration, see Physics.UiPanelUpdateSystem shows how to position a UI panel in front of the user’s headset:val head = systemManager.tryFindSystem<PlayerBodyAttachmentSystem>() ?.tryGetLocalPlayerAvatarBody()?.head
UiPanelUpdateSystem.kt for the complete positioning logic.scene.enablePassthrough(true) and requests scene permission using the standard Android permission flow for com.oculus.permission.USE_SCENE. See MixedRealitySampleActivity.kt for the complete permission handling sequence. For more on passthrough configuration, see Passthrough reference.BallShooter.kt to change bounce behavior, ball size, or velocity. Try lower restitution values for less bounce or larger dimensions for a bigger ball.null in AnchorProceduralMeshConfig to make collision surfaces visible. This helps when debugging room alignment.SpatialVideoSample for spatial audio patterns.