/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
namespace NRKernal
{
using UnityEngine;
/// Values that represent controller anchor enums.
public enum ControllerAnchorEnum
{
/// An enum constant representing the gaze pose tracker anchor option.
GazePoseTrackerAnchor,
/// An enum constant representing the right pose tracker anchor option.
RightPoseTrackerAnchor,
/// An enum constant representing the left pose tracker anchor option.
LeftPoseTrackerAnchor,
/// An enum constant representing the right model anchor option.
RightModelAnchor,
/// An enum constant representing the left model anchor option.
LeftModelAnchor,
/// An enum constant representing the right laser anchor option.
RightLaserAnchor,
/// An enum constant representing the left laser anchor option.
LeftLaserAnchor
}
///
/// The class is for user to easily get the transform of common controller anchors.
[HelpURL("https://developer.nreal.ai/develop/unity/controller")]
public class ControllerAnchorsHelper : MonoBehaviour
{
/// The gaze pose tracker anchor.
[SerializeField]
private Transform m_GazePoseTrackerAnchor;
/// The right pose tracker anchor.
[SerializeField]
private Transform m_RightPoseTrackerAnchor;
/// The left pose tracker anchor.
[SerializeField]
private Transform m_LeftPoseTrackerAnchor;
/// The right model anchor.
[SerializeField]
private Transform m_RightModelAnchor;
/// The left model anchor.
[SerializeField]
private Transform m_LeftModelAnchor;
/// The right laser anchor.
[SerializeField]
private Transform m_RightLaserAnchor;
/// The left laser anchor.
[SerializeField]
private Transform m_LeftLaserAnchor;
/// Gets an anchor.
/// The anchor enum.
/// The anchor.
public Transform GetAnchor(ControllerAnchorEnum anchorEnum)
{
switch (anchorEnum)
{
case ControllerAnchorEnum.GazePoseTrackerAnchor:
return m_GazePoseTrackerAnchor;
case ControllerAnchorEnum.RightPoseTrackerAnchor:
return m_RightPoseTrackerAnchor;
case ControllerAnchorEnum.LeftPoseTrackerAnchor:
return m_LeftPoseTrackerAnchor;
case ControllerAnchorEnum.RightModelAnchor:
return m_RightModelAnchor;
case ControllerAnchorEnum.LeftModelAnchor:
return m_LeftModelAnchor;
case ControllerAnchorEnum.RightLaserAnchor:
return m_RightLaserAnchor;
case ControllerAnchorEnum.LeftLaserAnchor:
return m_LeftLaserAnchor;
default:
break;
}
return null;
}
}
}