如何在ARReferencePoint上获取TrackableID。我看不到该点或其经理公开此属性。
我可以通过击中ARRaycastHit的射线广播获得ARPlanes的TrackableID,但ARReferencePoints并非如此。
具有ReferencePoint的名称或通过ARReferencePointManager的GetAllReferencePoints方法获取它时,将返回ReferecePoint游戏对象名称,后跟可跟踪ID。将该名称修剪为字符串,并将trackableID部分转换为(TrackableID)不起作用。
此外,出于性能方面的考虑,我希望避免每次都遍历所有参考点,因为在创建参考点时,我拥有参考点及其实例的名称。
private string TrimString(ARReferencePoint currRefPoint)
{
String TrackableIDOnly = currRefPoint.gameObject.name;//name is e.g. "ReferencePoint A4300T6" where A4300T6 is the TrackableID
return TrackableIDOnly.Remove(0, 15);
}
TrackableId currRefPointTrackableID = TrimString(m_CurrentRefPoint);//can't cast string to TrackableID