A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ValveSoftware/openvr/wiki/SteamVR-Input below:

SteamVR Input · ValveSoftware/openvr Wiki · GitHub

To read controller input state in OpenVR, an application provides a list of the "actions" that represent the operations a user can perform in the application. SteamVR then binds those actions to actual inputs on a game/vr controller, or more specifically input components provided for the input devices that the user is using. Application developers can provide default bindings for any controller types they like. Users are able to modify those bindings or create new bindings for new devices. Users can also select bindings that were shared by other users.

To use the IVRInput API in an application, a developer should take the following steps:

  1. Check "Enable debugging options in the input binding user interface" under Developer settings in SteamVR. This will enable some options that will be used in later steps.
  2. Create an action manifest file to allow SteamVR to know what actions exist in the application.
  3. Add a call to vr::VRInput()->SetActionManifestPath() to the application's initialization. This function takes an absolute path to the application's action manifest file.
  4. Add several calls to vr::VRInput()->GetActionHandle() to the application's initialization. These calls turn action paths (e.g. /actions/my_app/in/DoSomething) into handles that can be used at runtime.
  5. Add one or more calls to vr::VRInput()->GetActionSetHandle() to the application's initialization. These calls turn action set paths (e.g. /actions/my_app) into handles that can be used at runtime.
  6. Add a call to vr::VRInput()->UpdateActionState() at the top of the application's input processing code before reading any action state.
  7. Add calls to vr::VRInput()->Get*ActionData() for each action used by the application. Make the results from those calls perform the action in the application.
  8. Run the application.
  9. From the SteamVR menu, Select "Devices"->"Controller Input Binding" and select your application, which should be listed as the current one. The system should list "No Bindings Found", but will allow you to create a new one for editing.
  10. Make some bindings using the UI and then click "Replace Default Binding" at the bottom of the screen. The changes will be saved out to the folder where the action manifest JSON file was placed. Usually putting the bindings next to the action manifest file is he best choice.
  11. Edit the action manifest and add a default_bindings section that refers to your default binding file.
  12. Repeat 8-10 for other controller types you want to provide default bindings for.
  13. Include your action manifest and all your default binding files in your app when it releases.

EVRInputError IVRInput::SetActionManifestPath( const char *pchActionManifestPath )

Sets the path to the action manifest JSON file that is used by this application. If this information was set on the Steam partner site, calls to this function are ignored. If the Steam partner site setting and the path provided by this call are different, VRInputError_MismatchedActionManifest is returned. This call must be made before the first call to IVRInput::UpdateActionState or IVRSystem::PollNextEvent.

EVRInputError IVRInput::GetActionSetHandle( const char *pchActionSetName, VRActionSetHandle_t *pHandle )

Returns a handle for an action set. This handle is used for all performance-sensitive calls.

For best performance, applications should call this function once per action set name and save the returned handle for later use.

EVRInputError IVRInput::GetActionHandle( const char *pchActionName, VRActionHandle_t *pHandle )

Returns a handle for an action. This handle is used for all performance-sensitive calls.

For best performance, applications should call this function once per action name and save the returned handle for later use.

EVRInputError IVRInput::GetInputSourceHandle( const char *pchInputSourcePath, VRInputValueHandle_t *pHandle )

Returns a handle for an input source. This handle is used for all performance-sensitive calls.

For best performance, applications should call this function once per input source path they use.

EVRInputError IVRInput::UpdateActionState( VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount )

Reads the current state into all actions. After this call, the results of Get*ActionData calls will be the same until the next call to UpdateActionState. Applications should typically call this function once per frame.

struct VRActiveActionSet_t
{
	VRActionSetHandle_t ulActionSet;
	VRInputValueHandle_t ulRestrictedToDevice;
	VRActionSetHandle_t ulSecondaryActionSet;
};

This structure describes one active action set for a given frame.

EVRInputError IVRInput::GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize )

Reads the state of a digital action given its handle. This will return VRInputError_WrongType if the type of action is something other than digital.

struct InputDigitalActionData_t
{
	bool bActive;
	VRInputValueHandle_t activeOrigin;
	bool bState;
	bool bChanged;
	float fUpdateTime;
};

EVRInputError IVRInput::GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize )

Reads the state of an analog action given its handle. This will return VRInputError_WrongType if the type of action is something other than analog.

struct InputAnalogActionData_t
{
	bool bActive;
	VRInputValueHandle_t activeOrigin;
	float x, y, z;
	float deltaX, deltaY, deltaZ;
	float fUpdateTime;
};

EVRInputError IVRInput::GetPoseActionData( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize )

Gets the pose of the pose action as of the prediction time.

struct InputPoseActionData_t
{
	bool bActive;

	VRInputValueHandle_t activeOrigin;

	TrackedDevicePose_t pose;
};

EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude )

Triggers a haptic vibration action.

EVRInputError GetActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VRInputValueHandle_t *originsOut, uint32_t originOutCount )

Retrieves the action sources for an action. If the action has more origins than will fit in the array, only the number that will fit in the array are returned. If the action has fewer origins, the extra array entries will be set to k_ulInvalidInputValueHandle

EVRInputError GetOriginLocalizedName( VRInputValueHandle_t origin, char *pchNameArray, uint32_t unNameArraySize )

Retrieves the localized name of the action source in the current locale. This is of the form "device controller_type input_source". E.g. "Right Hand Knuckles Controller Trigger".

EVRInputError GetOriginTrackedDeviceInfo( VRInputValueHandle_t origin, InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize )

Returns information about the tracked device associated from the input source.

struct InputOriginInfo_t
{
	VRInputValueHandle_t devicePath;
	TrackedDeviceIndex_t trackedDeviceIndex;
	char rchRenderModelComponentName[128];
};

EVRInputError ShowActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t ulActionHandle )

Shows the current binding for the specified action in-headset. At the moment this function shows the entire binding UI, but that behavior will likely change down the road.

EVRInputError ShowBindingsForActionSet( VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight )

Shows the current binding for the specified action sets in-headset. At the moment this function shows the entire binding UI, but that behavior will likely change down the road.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4