SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
5.2 KiB

4 years ago
  1. # About AR Subsystems
  2. A [subsystem](https://docs.unity3d.com/ScriptReference/Subsystem.html) is a platform-agnostic interface for surfacing different types of functionality and data. The AR-related subsystems are defined in this package and use the namespace `UnityEngine.XR.ARSubsystems`. This package only provides the interface for various subsystems. Implementations for these subsystems (called "providers") can typically be found in another package or plugin.
  3. This package provides interfaces for the following subsystems:
  4. - [Session](session-subsystem.md)
  5. - [Raycasting](raycasting-subsystem.md)
  6. - [Camera](camera-subsystem.md)
  7. - [Plane Detection](plane-subsystem.md)
  8. - [Depth](depth-subsystem.md)
  9. - [Image Tracking](image-tracking.md)
  10. - [Face Tracking](face-tracking.md)
  11. - [Environment Probes](environment-probe-subsystem.md)
  12. # Installing AR Subsystems
  13. To install this package, follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html).
  14. Subsystems are implemented in other packages, so to use AR Subsystems, you will also need to install at least one platform-specific AR package (*Window > Package Manager*):
  15. - ARKit XR Plugin
  16. - ARCore XR Plugin
  17. These packages are called subsystem "providers".
  18. # Using AR Subsystems
  19. All subsystems have the same lifecycle: they can be created, started, stopped, and destroyed. Each subsystem has a corresponding `SubsystemDescriptor`, which describes the capabilities of a particular provider. Use the `SubsystemManager` to enumerate the available subsystems of a particular type. Once you have a valid subsystem descriptor, you can `Create()` the subsystem. This is the only way to construct a valid subsystem.
  20. **Example:** Picking a plane subsystem
  21. In this example, we iterate through all the `XRPlaneSubsystemDescriptor`s looking for one which supports a particular feature, then create it. You may only have a single subsystem per platform.
  22. ```csharp
  23. XRPlaneSubsystem CreatePlaneSubsystem()
  24. {
  25. // Get all available plane subsystems:
  26. var descriptors = new List<XRPlaneSubsystemDescriptor>();
  27. SubsystemManager.GetSubsystemDescriptors(descriptors);
  28. // Find one that supports boundary vertices
  29. foreach (var descriptor in descriptors)
  30. {
  31. if (descriptor.supportsBoundaryVertices)
  32. {
  33. // Create this plane subsystem
  34. return descriptor.Create();
  35. }
  36. }
  37. return null;
  38. }
  39. ```
  40. Once created, you can `Start` and `Stop` the subsystem. The exact behavior of `Start` and `Stop` varies by subsystem, but generally corresponds to "start doing work" and "stop doing work". A subsystem can be started and stopped multiple times. To completely destroy the subsystem instance, call `Destroy` on the subsystem. It is not valid to access a subsystem after it has been destroyed.
  41. ```csharp
  42. var planeSubsystem = CreatePlaneSubsystem();
  43. if (planeSubsystem != null)
  44. {
  45. // Start plane detection
  46. planeSubsystem.Start();
  47. }
  48. // ... some time later ...
  49. if (planeSubsystem != null)
  50. {
  51. // Stop plane detection. This does not discard already detected planes.
  52. planeSubsystem.Stop();
  53. }
  54. // ... when shutting down the AR portion of the app ...
  55. if (planeSubsystem != null)
  56. {
  57. planeSubsystem.Destroy();
  58. planeSubsystem = null;
  59. }
  60. ```
  61. Refer to the subsystem-specific documentation list above for more details concerning each subsystem provided by this package.
  62. # Implementing an AR Subsystem
  63. If you are implementing one of the AR Subsystems described by this package (e.g., you are a hardware manufacturer for a new AR device), you will need to implement a concrete instance of the relevant abstract base class provided in this package. Those types are typically named `XR<feature>Subsystem`.
  64. Each subsystem has a nested class called `IProvider`. This is the primary interface you'll need to implement for each subsystem you plan to support.
  65. ## Tracking Subsystems
  66. A "tracking" subsystem is any subsystem which detects and tracks something in the physical environment. Examples include plane tracking and image tracking. The thing tracked by the tracking subsystem is called a "trackable". For example, the plane subsystem detects planes, so a plane is a trackable.
  67. Each tracking subsystem requires you to implement a method called `GetChanges`. The purpose of this method is to retrieve data about the trackables it manages. Each trackable can be uniquely identified by a `TrackableId`, a 128-bit guid. A trackable can be added, updated, or removed. It is an error to update or remove a trackable that has not been added. Likewise, a trackable cannot be removed without having been added, nor updated if it has not been added or was already removed.
  68. `GetChanges` should report all added, updated, and removed trackables since the previous call to `GetChanges`. You should expect `GetChanges` to be called once per frame.
  69. Refer to the [Scripting API Reference](../api/) for more details.
  70. # Technical details
  71. ## Requirements
  72. This version of AR Foundation is compatible with the following versions of the Unity Editor:
  73. * 2019.2a8 and later
  74. ## Known limitations
  75. AR Foundation includes the following known limitations:
  76. * No known issues
  77. ## Document revision history
  78. |Date|Reason|
  79. |---|---|
  80. |April 22, 2019|Document created.|