public bool Connect(IMoCapClient_ConnectionInfo connectionInfo)
		{
			connected = VRDevice.isPresent;

			if (connected)
			{
				system = OpenVR.System;
				if (system == null)
				{
					connected = false;
					Debug.LogWarning("Could not find OpenVR System instance.");
				}
				compositor = OpenVR.Compositor;
				if (compositor == null)
				{
					connected = false;
					Debug.LogWarning("Could not find OpenVR Compositor instance.");
				}
			}

			if (connected)
			{
				poses     = new TrackedDevicePose_t[OpenVR.k_unMaxTrackedDeviceCount];
				gamePoses = new TrackedDevicePose_t[0];

				FindControllerIndices();
				scene.actors  = new Actor[controllerIndices.Length];
				scene.devices = new Device[controllerIndices.Length];
				states        = new VRControllerState_t[controllerIndices.Length];

				for (int idx = 0; idx < controllerIndices.Length; idx++)
				{
					string name = "Controller" + (idx + 1);

					Actor actor        = new Actor(scene, name, idx);
					actor.bones        = new Bone[1];
					actor.bones[0]     = new Bone(actor, "root", 0);
					scene.actors[idx]  = actor;

					Device device      = new Device(scene, name, idx);
					device.channels    = new Channel[7];
					device.channels[0] = new Channel(device, "button1");  // fire
					device.channels[1] = new Channel(device, "button2");  // menu
					device.channels[2] = new Channel(device, "button3");  // grip
					device.channels[3] = new Channel(device, "axis1");    // touchpad + press
					device.channels[4] = new Channel(device, "axis2");
					device.channels[5] = new Channel(device, "axis1raw"); // touchpad touch
					device.channels[6] = new Channel(device, "axis2raw");

					scene.devices[idx] = device;
				}
			}
			return connected;
		}
Ejemplo n.º 2
0
    void UpdateHandPoses()
    {
        SteamVR vr = SteamVR.instance;

        if (vr != null)
        {
            var pose     = new Valve.VR.TrackedDevicePose_t();
            var gamePose = new Valve.VR.TrackedDevicePose_t();
            var err      = vr.compositor.GetLastPoseForTrackedDeviceIndex((uint)index, ref pose, ref gamePose);
            if (err == Valve.VR.EVRCompositorError.None)
            {
                isValid = gamePose.bPoseIsValid;

                var t = new SteamVR_Utils.RigidTransform(gamePose.mDeviceToAbsoluteTracking);
                transform.localPosition = t.pos;
                transform.localRotation = t.rot;
            }
        }
    }
Ejemplo n.º 3
0
	public override void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRSystem_GetDeviceToAbsoluteTrackingPose(m_pVRSystem,eOrigin,fPredictedSecondsToPhotonsFromNow,pTrackedDevicePoseArray,(uint) pTrackedDevicePoseArray.Length);
	}
Ejemplo n.º 4
0
	internal static extern bool VR_IVRSystem_PollNextEventWithPose(IntPtr instancePtr, ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, ref TrackedDevicePose_t pTrackedDevicePose);
Ejemplo n.º 5
0
	internal static extern void VR_IVRSystem_ApplyTransform(IntPtr instancePtr, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform);
Ejemplo n.º 6
0
	public abstract bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin,ref VREvent_t pEvent,ref TrackedDevicePose_t pTrackedDevicePose);
Ejemplo n.º 7
0
	public abstract void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray);
Ejemplo n.º 8
0
 // Token: 0x06001F57 RID: 8023 RVA: 0x0009D5B2 File Offset: 0x0009B7B2
 public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose)
 {
     return(this.FnTable.GetLastPoseForTrackedDeviceIndex(unDeviceIndex, ref pOutputPose, ref pOutputGamePose));
 }
Ejemplo n.º 9
0
	public EVRCompositorError GetLastPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray)
	{
		EVRCompositorError result = FnTable.GetLastPoses(pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length);
		return result;
	}
Ejemplo n.º 10
0
	public abstract VRCompositorError WaitGetPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray);
Ejemplo n.º 11
0
 // Token: 0x06001EF8 RID: 7928 RVA: 0x0009CC28 File Offset: 0x0009AE28
 public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose)
 {
     if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
     {
         VRControllerState_t_Packed vrcontrollerState_t_Packed = new VRControllerState_t_Packed(pControllerState);
         CVRSystem.GetControllerStateWithPoseUnion getControllerStateWithPoseUnion;
         getControllerStateWithPoseUnion.pGetControllerStateWithPosePacked = null;
         getControllerStateWithPoseUnion.pGetControllerStateWithPose       = this.FnTable.GetControllerStateWithPose;
         bool result = getControllerStateWithPoseUnion.pGetControllerStateWithPosePacked(eOrigin, unControllerDeviceIndex, ref vrcontrollerState_t_Packed, (uint)Marshal.SizeOf(typeof(VRControllerState_t_Packed)), ref pTrackedDevicePose);
         vrcontrollerState_t_Packed.Unpack(ref pControllerState);
         return(result);
     }
     return(this.FnTable.GetControllerStateWithPose(eOrigin, unControllerDeviceIndex, ref pControllerState, unControllerStateSize, ref pTrackedDevicePose));
 }
Ejemplo n.º 12
0
 // Token: 0x06001EF4 RID: 7924 RVA: 0x0009CB5C File Offset: 0x0009AD5C
 public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose)
 {
     return(this.FnTable.PollNextEventWithPose(eOrigin, ref pEvent, uncbVREvent, ref pTrackedDevicePose));
 }
Ejemplo n.º 13
0
 // Token: 0x06001EE7 RID: 7911 RVA: 0x0009C9E1 File Offset: 0x0009ABE1
 public void ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform)
 {
     this.FnTable.ApplyTransform(ref pOutputPose, ref pTrackedDevicePose, ref pTransform);
 }
Ejemplo n.º 14
0
 public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, ref TrackedDevicePose_t pTrackedDevicePose)
 {
     return(this.FnTable.GetControllerStateWithPose(eOrigin, unControllerDeviceIndex, ref pControllerState, ref pTrackedDevicePose));
 }
Ejemplo n.º 15
0
	public override bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin,ref VREvent_t pEvent,ref TrackedDevicePose_t pTrackedDevicePose)
	{
		CheckIfUsable();
		bool result = VRNativeEntrypoints.VR_IVRSystem_PollNextEventWithPose(m_pVRSystem,eOrigin,ref pEvent,ref pTrackedDevicePose);
		return result;
	}
Ejemplo n.º 16
0
 public bool PollNextEvent(ref VREvent_t pEvent, uint uncbVREvent) => default;                                                                                                                                                       // 0x00000001811E0C00-0x00000001811E0D80
 public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose) => default;                                                                  // 0x00000001811E0BD0-0x00000001811E0C00
Ejemplo n.º 17
0
 public bool GetControllerState(uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize) => default;                                                                                      // 0x00000001811E0340-0x00000001811E0530
 public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose) => default; // 0x00000001811E0120-0x00000001811E0340
Ejemplo n.º 18
0
	public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex,ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pOutputGamePose)
	{
		EVRCompositorError result = FnTable.GetLastPoseForTrackedDeviceIndex(unDeviceIndex,ref pOutputPose,ref pOutputGamePose);
		return result;
	}
Ejemplo n.º 19
0
        public EDeviceActivityLevel GetTrackedDeviceActivityLevel(uint unDeviceId) => default;                                                                                        // 0x00000001811E0A60-0x00000001811E0A90

        public void ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform)
        {
        }                                                                                                                                                                                                                                   // 0x00000001811DFF00-0x00000001811DFF30
Ejemplo n.º 20
0
	public override EVRCompositorError GetLastPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray)
	{
		CheckIfUsable();
		EVRCompositorError result = VRNativeEntrypoints.VR_IVRCompositor_GetLastPoses(m_pVRCompositor,pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length);
		return result;
	}
Ejemplo n.º 21
0
 public EVRCompositorError WaitGetPoses(TrackedDevicePose_t[] pRenderPoseArray, TrackedDevicePose_t[] pGamePoseArray)
 {
     return this.FnTable.WaitGetPoses(pRenderPoseArray, (uint)pRenderPoseArray.Length, pGamePoseArray, (uint)pGamePoseArray.Length);
 }
Ejemplo n.º 22
0
	public abstract void ApplyTransform(ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pTrackedDevicePose,ref HmdMatrix34_t pTransform);
Ejemplo n.º 23
0
 public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose)
 {
     return this.FnTable.GetLastPoseForTrackedDeviceIndex(unDeviceIndex, ref pOutputPose, ref pOutputGamePose);
 }
Ejemplo n.º 24
0
	public abstract bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,ref TrackedDevicePose_t pTrackedDevicePose);
Ejemplo n.º 25
0
	public void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray)
	{
		FnTable.GetDeviceToAbsoluteTrackingPose(eOrigin,fPredictedSecondsToPhotonsFromNow,pTrackedDevicePoseArray,(uint) pTrackedDevicePoseArray.Length);
	}
Ejemplo n.º 26
0
	public abstract EVRCompositorError GetLastPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray);
Ejemplo n.º 27
0
	public void ApplyTransform(ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pTrackedDevicePose,ref HmdMatrix34_t pTransform)
	{
		FnTable.ApplyTransform(ref pOutputPose,ref pTrackedDevicePose,ref pTransform);
	}
Ejemplo n.º 28
0
	internal static extern bool VR_IVRSystem_GetControllerStateWithPose(IntPtr instancePtr, ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, ref TrackedDevicePose_t pTrackedDevicePose);
Ejemplo n.º 29
0
	public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin,ref VREvent_t pEvent,uint uncbVREvent,ref TrackedDevicePose_t pTrackedDevicePose)
	{
		bool result = FnTable.PollNextEventWithPose(eOrigin,ref pEvent,uncbVREvent,ref pTrackedDevicePose);
		return result;
	}
Ejemplo n.º 30
0
	public override void ApplyTransform(ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pTrackedDevicePose,ref HmdMatrix34_t pTransform)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRSystem_ApplyTransform(m_pVRSystem,ref pOutputPose,ref pTrackedDevicePose,ref pTransform);
	}
Ejemplo n.º 31
0
	public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,ref TrackedDevicePose_t pTrackedDevicePose)
	{
		bool result = FnTable.GetControllerStateWithPose(eOrigin,unControllerDeviceIndex,ref pControllerState,ref pTrackedDevicePose);
		return result;
	}
Ejemplo n.º 32
0
	public override bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,ref TrackedDevicePose_t pTrackedDevicePose)
	{
		CheckIfUsable();
		bool result = VRNativeEntrypoints.VR_IVRSystem_GetControllerStateWithPose(m_pVRSystem,eOrigin,unControllerDeviceIndex,ref pControllerState,ref pTrackedDevicePose);
		return result;
	}
Ejemplo n.º 33
0
 public EVRCompositorError GetLastPoses(TrackedDevicePose_t[] pRenderPoseArray, TrackedDevicePose_t[] pGamePoseArray) => default;                                         // 0x00000001811DD690-0x00000001811DD6D0
 public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose) => default; // 0x00000001811DD660-0x00000001811DD690