The sample provides the ability to control various aspects of of the scene and Tracked Keyboard experience, including toggling passthrough for the entier scene and toggling the visual cue for the tracked keyboard.
Text input from the tracked keyboard is handled and displayed in the text box on the UI.
The current status of the the tracked keyboard is displayed along with a button to connect a keyboard to track.
Input Suppression
In order to keep other interactions, such as ray casting, from being triggered while typing on the keyboard, the sample suppresses those other interactions by detecting that the hands are interacting with the keyboard and disabling the interactors for the other interactions until the hands stop interacting with the keybaord.
The KeyboardInteractionManager handles events for the intersection between the keyboard prefab collider and colliders on the LeftHandAnchor and RightHandAnchorGameObjects inside the rig. When one of the hand colliders enters the keyboard collider, UpdateHandProximity() is called to disable that hand’s RayInteractor. This ensures it is a hand that is colliding and then calls SetRayInteractorState() for that hand index to set the Enabled property of the interactor to false. When the hand exits the keyboard collider, ResetHandState() is called to enable the RayInteractor for that hand again.
Integrating Tracked Keyboard into your Project
To integrate this Tracked Keyboard functionality into your own project, download and run the Tracked Keyboard sample by following the instructions provided in the readme on GitHub.
Export the Tracked Keyboard package from the sample project by navigating to Assets/TrackedKeyboard/Scenes, right-clicking on TrackedKeyboard scene, and selecting Export Package.
Double-click on the exported package and click Import to import the package into your personal project.
In the main menu, go to Meta > Tools > Project Setup to open the Project Setup tool. Select Fix All for Android and Standalone.
Press the Play button to test the scene in the editor.
In the main menu, select File > Build Settings... and then choose Switch to Android. Add the TrackedKeyboard scene by selecting Add Open Scenes. Ensure your headset is plugged in and then click Build and Run.
Setting up Tracked Keyboard in Your Scene
Create a new GameObject in your scene and add the MRUK script to it. This will expose events for TrackableAdded and TrackableRemoved.
Create a new GameObject and add the Tracked Keyboard Manager script from the Tracked Keyboard package to it. This script uses events from the MRUK scripts to manage the tracked keyboard behavior in mixed reality.
In the inspector, assign all required references to configure the Tracked Keyboard Manager. Use the sample scene as a reference.
Keyboard Prefab - Assign the prefab for the tracked keyboard.
Left Hand and Right Hand - Assign the left and right hand GameObjects.
Passthrough Layers - Assign the passthrough layers for underlay and overlay.
Configure the Ray Interactors in the OVRInteraction rig and add capsule colliders to detect hand proximity with the keyboard.
Go to CameraRig > TrackingSpace > LeftHandAnchor/RightHandAnchor.
Add a Capsule Collider component to each hand anchor.
Adjust the collider size and position to match your hand model.
Add the Custom Pointable Canvas Module to support mouse and keyboard input for Interaction SDK UI Panels.
Note: You can customize the appearance and behavior of the tracked keyboard by modifying the Keyboard Prefab and the boundary visual scriptable objects under Assets/TrackedKeyboard/ScriptableObjects.