Beispiel #1
0
 public static void PollForEvents()
 {
     while (VRSystem.PollNextEvent(ref pEvent, (uint)VREventSize))
     {
         HandleEvent(pEvent);
     }
 }
Beispiel #2
0
    public float GetBatteryLevel(uint deviceId)
    {
        ETrackedPropertyError error = ETrackedPropertyError.TrackedProp_InvalidDevice;

        var batteryLevel = VRSystem.GetFloatTrackedDeviceProperty(deviceId, ETrackedDeviceProperty.Prop_DeviceBatteryPercentage_Float, ref error);

        return(batteryLevel);
    }
    public Vector3 GetEyeTransform(EVREye eye)
    {
        if (!SysExists)
        {
            return(Vector3.zero);
        }

        return((new OVR_Utils.RigidTransform(VRSystem.GetEyeToHeadTransform(eye))).pos);
    }
    private bool PollNextEvent(ref VREvent_t pEvent)
    {
        if (VRSystem == null)
        {
            return(false);
        }

        var size = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(Valve.VR.VREvent_t));

        return(VRSystem.PollNextEvent(ref pEvent, size));
    }
    public void UpdatePoses()
    {
        if (!CompExists || !SysExists)
        {
            return;
        }

        rightIndex = VRSystem.GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole.RightHand);
        leftIndex  = VRSystem.GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole.LeftHand);

        Compositor.GetLastPoses(poses, gamePoses);
    }
Beispiel #6
0
        public GripHandler(VRSystem vrSystem, OVRInput.Controller oculusController, InputDevice controllerInputDevice, float threshold) : base(threshold)
        {
            _oculusController      = oculusController;
            _controllerInputDevice = controllerInputDevice;
            if (vrSystem == VRSystem.Oculus)
            {
                _valueFunc = GetValueOculus;
            }
            else
            {
                _valueFunc = GetValueSteam;
            }

            IsReversed = PluginConfig.Instance.ReverseGrip;
        }
Beispiel #7
0
    public Dictionary <int, string> GetTrackers()
    {
        Dictionary <int, string> trackers = new Dictionary <int, string>();

        for (int i = 0; i <= 16; i++)
        {
            var deviceClass = VRSystem.GetTrackedDeviceClass((uint)i);
            if (deviceClass == ETrackedDeviceClass.GenericTracker)
            {
                ETrackedPropertyError error   = new ETrackedPropertyError();
                StringBuilder         builder = new StringBuilder();
                VRSystem.GetStringTrackedDeviceProperty((uint)i, ETrackedDeviceProperty.Prop_SerialNumber_String, builder, 10000, ref error);
                trackers.Add(i, builder.ToString());
            }
        }
        return(trackers);
    }
Beispiel #8
0
 public GripHandler(VRSystem vrSystem,
                    OVRInput.Controller oculusController,
                    InputDevice controllerInputDevice,
                    float threshold,
                    bool isReversed = false)
     : base(threshold, isReversed)
 {
     _oculusController      = oculusController;
     _controllerInputDevice = controllerInputDevice;
     if (vrSystem == VRSystem.Oculus)
     {
         _valueFunc = GetValueOculus;
     }
     else
     {
         _valueFunc = GetValueSteam;
     }
 }