123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
-
- namespace NRKernal
- {
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class NRTrackablePlane : NRTrackable
- {
- internal NRPlaneSubsystem PlaneSubsystem
- {
- get
- {
- return NRSessionManager.Instance.TrackableFactory.PlaneSubsystem;
- }
- }
-
-
-
- internal NRTrackablePlane(UInt64 nativeHandle) : base(nativeHandle)
- {
- }
-
- TrackablePlaneType trackablePlaneType;
-
-
- public TrackablePlaneType GetPlaneType()
- {
- if (NRFrame.SessionStatus != SessionState.Running)
- {
- return trackablePlaneType;
- }
- trackablePlaneType = PlaneSubsystem.GetPlaneType(TrackableNativeHandle);
- return trackablePlaneType;
- }
-
- Pose centerPose;
-
-
-
- public override Pose GetCenterPose()
- {
- if (NRFrame.SessionStatus != SessionState.Running)
- {
- return centerPose;
- }
- centerPose = PlaneSubsystem.GetCenterPose(TrackableNativeHandle);
- return ConversionUtility.ApiWorldToUnityWorld(centerPose);
- }
-
-
-
- public float ExtentX
- {
- get
- {
- if (NRFrame.SessionStatus != SessionState.Running)
- {
- return 0;
- }
- return PlaneSubsystem.GetExtentX(TrackableNativeHandle);
- }
- }
-
-
-
- public float ExtentZ
- {
- get
- {
- if (NRFrame.SessionStatus != SessionState.Running)
- {
- return 0;
- }
- return PlaneSubsystem.GetExtentZ(TrackableNativeHandle);
- }
- }
-
-
-
-
- public void GetBoundaryPolygon(List<Vector3> polygonList)
- {
- if (NRFrame.SessionStatus != SessionState.Running)
- {
- return;
- }
- var planetype = GetPlaneType();
- if (planetype == TrackablePlaneType.INVALID)
- {
- NRDebugger.Error("Invalid plane type.");
- return;
- }
- PlaneSubsystem.GetBoundaryPolygon(TrackableNativeHandle, polygonList);
- }
- }
- }
|