SvrControllerState.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.Events;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Runtime.CompilerServices;
  8. using System.Runtime.InteropServices;
  9. using UnityEngine.Internal;
  10. using UnityEngine.Scripting;
  11. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  12. public struct SvrControllerCaps
  13. {
  14. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
  15. public String deviceManufacturer;
  16. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
  17. public String deviceIdentifier;
  18. public UInt32 caps; //0 bit = Provides Rotation; 1 bit = Position;
  19. public UInt32 activeButtons;
  20. public UInt32 active2DAnalogs;
  21. public UInt32 active1DAnalogs;
  22. public UInt32 activeTouchButtons;
  23. };
  24. /// <summary>
  25. /// Svr controller state.
  26. /// This should change if the SvrControllerState changes in svrApi.h
  27. /// Currently this assumes the default packing in svrApi.h
  28. /// If that changes. Change this accordingly.
  29. /// </summary>
  30. public struct SvrControllerState {
  31. public Quaternion rotation;
  32. public Vector3 position;
  33. public Vector3 gyro;
  34. public Vector3 accelerometer;
  35. public long timestamp;
  36. public int buttonState;
  37. [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4)]
  38. public Vector2[] analog2D;
  39. [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8)]
  40. public float[] analog1D;
  41. public int isTouching;
  42. public int connectionState;
  43. };