12345678910111213141516171819202122232425262728293031323334353637383940 |
-
- using System.Collections.Generic;
- using UnityEngine;
- namespace NRKernal.NRExamples
- {
-
- [HelpURL("https://developer.nreal.ai/develop/discover/introduction-nrsdk")]
- public class PlaneDetector : MonoBehaviour
- {
-
- public GameObject DetectedPlanePrefab;
-
-
-
- private List<NRTrackablePlane> m_NewPlanes = new List<NRTrackablePlane>();
-
- public void Update()
- {
- NRFrame.GetTrackables<NRTrackablePlane>(m_NewPlanes, NRTrackableQueryFilter.New);
- for (int i = 0; i < m_NewPlanes.Count; i++)
- {
-
-
- GameObject planeObject = Instantiate(DetectedPlanePrefab, Vector3.zero, Quaternion.identity, transform);
- planeObject.GetComponent<NRTrackableBehaviour>().Initialize(m_NewPlanes[i]);
- }
- }
- }
- }
|