TagTracking.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using UnityEngine;
  2. namespace Ximmerse.XR.Tag
  3. {
  4. /// <summary>
  5. /// The state after losing the Tag
  6. /// </summary>
  7. public enum LostState
  8. {
  9. Stay,
  10. FollowHead,
  11. }
  12. /// <summary>
  13. /// Tag tracking function
  14. /// </summary>
  15. [AddComponentMenu("Ximmerse XR/Tag Tracking")]
  16. public class TagTracking : XRTracking
  17. {
  18. [Header("--- Marker Setting ---")]
  19. [SerializeField]
  20. private int trackID = 65;
  21. [SerializeField]
  22. LostState trackingIsLost = LostState.Stay;
  23. [Header("--- Debug Setting ---")]
  24. [SerializeField]
  25. private bool m_debugView = false;
  26. [SerializeField]
  27. private float m_size = 0.17f;
  28. #region Property
  29. /// <summary>
  30. /// Id
  31. /// </summary>
  32. public int TrackId
  33. {
  34. get => trackID;
  35. set => trackID = value;
  36. }
  37. /// <summary>
  38. /// Whether to enable debug mode
  39. /// </summary>
  40. public bool DebugView
  41. {
  42. get => m_debugView;
  43. set => m_debugView = value;
  44. }
  45. /// <summary>
  46. /// Axis dimensions in debug mode
  47. /// </summary>
  48. public float Size
  49. {
  50. get => m_size;
  51. set => m_size = value;
  52. }
  53. /// <summary>
  54. /// tracking state
  55. /// </summary>
  56. public bool isTracking
  57. {
  58. get => IsTracking();
  59. }
  60. /// <summary>
  61. /// Stay or FollowHead when lost tracking.
  62. /// </summary>
  63. public LostState TrackingIsLost
  64. {
  65. get => trackingIsLost;
  66. set => trackingIsLost = value;
  67. }
  68. #endregion
  69. }
  70. }