#pragma warning restore IEnumerator Start() { var boundaryPoints = new Vector2[4]; boundaryPoints[0] = new Vector2(-.5f, -.5f); boundaryPoints[1] = new Vector2(-.5f, +.5f); boundaryPoints[2] = new Vector2(+.5f, +.5f); boundaryPoints[3] = new Vector2(+.5f, -.5f); var planeId = PlaneApi.Add(pose, boundaryPoints); float angle = 0f; while (enabled) { if (m_Rotate) { transform.localRotation = Quaternion.AngleAxis(angle, Vector3.up); angle += Time.deltaTime * 10f; } PlaneApi.Update(planeId, pose, boundaryPoints); if (Random.value < m_TrackingLostProbability) { PlaneApi.SetTrackingState(planeId, TrackingState.None); yield return(new WaitForSeconds(1f)); PlaneApi.SetTrackingState(planeId, TrackingState.Tracking); } yield return(null); } }
#pragma warning restore IEnumerator Start() { var boundaryPoints = new Vector2[4]; boundaryPoints[0] = new Vector2(-.5f, -.5f); boundaryPoints[1] = new Vector2(-.5f, +.5f); boundaryPoints[2] = new Vector2(+.5f, +.5f); boundaryPoints[3] = new Vector2(+.5f, -.5f); var planeId = PlaneApi.Add(pose, boundaryPoints, TrackingState.Tracking, default, default, default, default);
IEnumerator Start() { var points = new Vector2[m_NumPoints]; var velocities = new Vector2[m_NumPoints]; for (int i = 0; i < points.Length; ++i) { points[i] = Random.insideUnitCircle * m_Radius; velocities[i] = Random.insideUnitCircle * m_Speed; } var planeId = PlaneApi.Add(pose, GenerateConvexHull(points), TrackingState.Tracking, default, default, default, default);
IEnumerator Start() { var points = new Vector2[m_NumPoints]; var velocities = new Vector2[m_NumPoints]; for (int i = 0; i < points.Length; ++i) { points[i] = Random.insideUnitCircle * m_Radius; velocities[i] = Random.insideUnitCircle * m_Speed; } var planeId = PlaneApi.Add(pose, GenerateConvexHull(points)); while (enabled) { var hullChanged = false; if (Random.value < m_HullChangeProbability) { for (int i = 0; i < points.Length; ++i) { if (points[i].magnitude > m_Radius && Vector3.Dot(points[i], velocities[i]) > 0) { velocities[i] = -velocities[i]; } points[i] += velocities[i] * Time.deltaTime; } hullChanged = true; } if (hullChanged || transform.hasChanged) { PlaneApi.Update(planeId, pose, GenerateConvexHull(points)); } transform.hasChanged = false; if (Random.value < m_TrackingLostProbability) { PlaneApi.SetTrackingState(planeId, TrackingState.Unavailable); yield return(new WaitForSeconds(1f)); PlaneApi.SetTrackingState(planeId, TrackingState.Tracking); } yield return(null); } }
public NativeSession(IntPtr sessionHandle, IntPtr frameHandle) { IsDestroyed = false; SessionHandle = sessionHandle; FrameHandle = frameHandle; m_PointCloudManager = new PointCloudManager(this); m_TrackableManager = new TrackableManager(this); AnchorApi = new AnchorApi(this); AugmentedFaceApi = new AugmentedFaceApi(this); AugmentedImageApi = new AugmentedImageApi(this); AugmentedImageDatabaseApi = new AugmentedImageDatabaseApi(this); CameraApi = new CameraApi(this); CameraConfigApi = new CameraConfigApi(this); CameraConfigFilterApi = new CameraConfigFilterApi(this); CameraConfigListApi = new CameraConfigListApi(this); CameraMetadataApi = new CameraMetadataApi(this); FrameApi = new FrameApi(this); HitTestApi = new HitTestApi(this); ImageApi = new ImageApi(); LightEstimateApi = new LightEstimateApi(this); PlaneApi = new PlaneApi(this); PointApi = new PointApi(this); PointCloudApi = new PointCloudApi(this); PoseApi = new PoseApi(this); SessionApi = new SessionApi(this); SessionConfigApi = new SessionConfigApi(this); TrackableApi = new TrackableApi(this); TrackableListApi = new TrackableListApi(this); #if !UNITY_EDITOR if (!s_ReportedEngineType) { SessionApi.ReportEngineType(); s_ReportedEngineType = true; } #endif }