New VR Keyboard API

The new SDK adds a preliminary version of the VR keyboard API. We would love to have some of you try it out and send some feedback. Please be aware that lots of specifics are likely to change in the future.



With this build the keyboard only supports "minimal mode". That means that as you enter text with the keyboard individual keystrokes are sent to your application and you are responsible for showing the user the state of their text entry. We will likely be adding a normal mode later where the keyboard collects all input until the user is finished and then you just get the whole buffer.



You can invoke the keyboard like this (Unity example)-



SteamVR.instance.overlay.ShowKeyboard(0, 0, "Description", 256, "", true);



You can also register for events that will fire when the user types and when the keyboard is closed-



SteamVR_Utils.Event.Listen("KeyboardCharInput", OnKeyboard);

SteamVR_Utils.Event.Listen("KeyboardClosed", OnKeyboardClosed);



As the user types your KeyboardCharInput event handler will be called-

private void OnKeyboard(object[] args)

{

VREvent_t evt = (VREvent_t) args[0];

if (evt.data.keyboard.cNewInput == "\b")

{ // User hit backspace

if(text.Length > 0)

{

text = text.Substring(0, text.Length - 1);

}

}

else if(evt.data.keyboard.cNewInput == "\x1b")

{

// Close the keyboard

SteamVR.instance.overlay.HideKeyboard();

}

else

{

text += evt.data.keyboard.cNewInput;

}

// Do something with the accumulated text here

}



Currently the keyboard comes up in a fixed location relative to where the user is looking when it is invoked. We are looking at a few other options for keyboard placement including possibly letting an application request a specific location.



We are looking for feedback on how you are using this and what capabilities you might need for it to work best.



