-
Notifications
You must be signed in to change notification settings - Fork 1
Sample Code
Cory Corvus edited this page May 19, 2020
·
9 revisions
-
Unity Sample Code
- Detect VR HMD and controller
- Reset head position
- Detect system button press (SteamVR Overlay) and enable/disable gameobject
- Get VIVE controller trigger full down/click
- Simple Laser Pointer
- Move objects to hand's position
- Power off SteamVR device
- VR Player Controller
- Subscribe to Action (SteamVR 2.x)
- Poll Action (SteamVR 2.x)
- Unreal Engine Sample Code
public void SubscribeToPlayerAction(SteamVR_Action_Boolean action, SteamVR_Action_Boolean.ChangeHandler onAction)
{
action.AddOnChangeListener(onAction, SteamInputSource); //SteamInputSource can be Left Right or Any
}
public bool CheckForPlayerAction(SteamVR_Action_Boolean action, ButtonAction buttonState = ButtonAction.PressDown)
{
if (buttonState == ButtonAction.PressDown) return action.GetStateDown(SteamInputSource);
if(buttonState == ButtonAction.IsPressed) return action.GetState(SteamInputSource);
return action.GetStateUp(SteamInputSource);
}