Use Building Blocks to Create a Passthrough Layer.
Keyboard tracking requires Scene and Anchor features to be enabled.
Click on Camera Rig > OVR Manager > General > Scene Support and select Required.
Click on Camera Rig > OVR Manager > General > Anchor Support and select Enabled.
To enable keyboard tracking in MRUK, add an MRUK component to a GameObject in your scene. Then, expand the Scene Settings > Tracker Configuration foldouts and check the Keyboard Tracking Enabled box.
Representation in Unity
Keyboards are a type of trackable (MRUKTrackable). Keyboards have the following properties:
A 6 degree-of-freedom pose (position and rotation) represented by a UnityEngine.Transform.
A 2D bounding box, accessible from MRUKAnchor.PlaneRect.
A 2D polygon, accessible from MRUKAnchor.PlaneBoundary2D.
A 3D bounding box, accessible from MRUKAnchor.VolumeBounds.
Trackable Events
When a new trackable is detected, MRUK creates a new GameObject and invokes the TrackableAdded event. Use the MRUKTrackable.TrackableType property to determine what type of trackable was detected.
public void OnTrackableAdded(MRUKTrackable trackable)
{
if (trackable.TrackableType == OVRAnchor.TrackableType.Keyboard)
{
Instantiate(keyboardPrefab, trackable.transform);
}
}
MRUK will continue to update the transform of the GameObject it created as it tracks the keyboard. If the keyboard is lost, MRUK will invoke the TrackableRemoved event.
Related Samples
Keyboard Tracker Sample
Demonstrates how to build a keyboard tracker using MRUKTrackables and trackable events. Includes the Bounded3DVisualizer that fits prefabs, such as a Passthrough Overlay, to a detected keyboard’s 3D bounds.
This sample showcases the tracked keyboard feature, providing a comprehensive panel for text input. In addition, the panel offers 2D and 3D visualization options for the keyboard. It also includes toggles for desk and passthrough modes, as well as tracking status. With these features, this sample provides a solid foundation for building mixed reality applications with tracked keyboards.