public void SwapLeftRight() { // Swap which controller type (LTouch or RTouch) is used by which controller info. OculusControllerInfo wandInfo = InputManager.Wand as OculusControllerInfo; OculusControllerInfo brushInfo = InputManager.Brush as OculusControllerInfo; OVRInput_Controller tmpType = wandInfo.m_ControllerType; wandInfo.m_ControllerType = brushInfo.m_ControllerType; brushInfo.m_ControllerType = tmpType; }
// This class tries to mimic the tracking done in SteamVR's SteamVR_TrackedObject, which updates // poses in response to the event "new_poses". This event is sent in // SteamVR_UpdatePoses.OnPreCull(). But OnPreCull() is only available to components attached to // the camera, which this class is not. So this public OnPreCull() is called exactly once // from OculusPreCullHook.OnPreCull() which is attached to the camera. public void OnPreCull() { // There are checks for each controller instead of a single check for // both so the player will know if either controller is having problems. foreach (ControllerInfo baseInfo in InputManager.Controllers) { OculusControllerInfo info = baseInfo as OculusControllerInfo; if (info == null) { continue; // should never happen } info.UpdatePosesAndValidity(); } if (NewPosesApplied != null) { NewPosesApplied(); } }