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.

98 lines
5.2 KiB

4 years ago
  1. # Migration Guide
  2. This guide covers the differences between AR Foundation 1.0 and 2.x.
  3. ## TL;DR
  4. * Add an `ARInputManager` anywhere in your scene.
  5. * Add an `ARCameraManager` to your AR Camera (this replaces the `ARCameraOptions`).
  6. * Ray cast via the `ARRaycastManager` instead of the `ARSessionOrigin`.
  7. * Some `TryGet`/`TryAdd`/`TryRemove` APIs were renamed to just `Get`/`Add`/`Remove`.
  8. * `GetAllXXX` is now a `trackables` property.
  9. * Added, updated, and removed events have been combined into a single event that contains lists of all the added, updated, and removed trackables.
  10. ## Events
  11. In AR Foundation 1.0, each trackable manager provided added, updated, and removed events for each trackable. In 2.x, each trackable manager has a single event invoked no more than once per frame. This event contains all the changes (added, updated, and removed) since the last frame.
  12. **Example:**
  13. | **1.0** | **2.0** |
  14. |-|-|
  15. | `ARPlaneManager.planeAdded`, `ARPlaneManager.planeUpdated`, `ARPlaneManager.planeRemoved` | `ARPlaneManager.planesChanged` |
  16. ## Session-relative data
  17. Many of the trackables in AR Foundation 1.0 had "session relative data" (for example, `BoundedPlane` and `XRReferencePoint`). These are no longer directly accessible. All their memebers are now properties of an AR Foundation trackable.
  18. **Example:**
  19. | **Trackable** | **1.0 accessor** | **2.0 accessor** |
  20. |-|-|-|
  21. |`ARPlane`|`boundedPlane.Id`|`trackableId`|
  22. ## Removed Try
  23. Several APIs used a `TryGet` or `TryAdd` style of API. Such methods that dealt with reference types have dropped the `Try` prefix.
  24. **Examples:**
  25. | **1.0** | **2.0** |
  26. |-|-|
  27. | `ARPlane.TryGetPlane(trackableId)` | `ARPlane.GetPlane(trackableId)` |
  28. | `ARReferencePoint.TryAddReferencePoint` | `ARReferencePoint.AddReferencePoint` |
  29. | `ARReferencePoint.TryAttachReferencePoint` | `ARReferencePoint.AttachReferencePoint` |
  30. | `bool ARReferencePoint.TryRemoveReferencePoint` | `bool ARReferencePoint.RemoveReferencePoint` |
  31. ## Enumerating trackables
  32. Trackable managers previously had a way to obtain a `List` of all trackables (for example, `ARPlaneManager.GetAllPlanes` and `ARReferencePointManager.GetAllReferencePoints`). There is now a common property called `trackables`, which can be used in a `foreach`, like in the following example:
  33. ```csharp
  34. var planeManager = GetComponent<ARPlaneManager>();
  35. foreach (var plane in planeManager.trackables) {
  36. // Do something with the plane
  37. }
  38. ```
  39. This property returns a `TrackablesCollection` which doesn't generate any garbage or cause boxing.
  40. ## ARSubsystemManager removed
  41. The `ARSubsystemManager` has been removed in 2.0. It was previously a singleton which provided access to each subsystem (a subsystem is a low-level interface to the AR platform). However, some subsystems were also simultaneously managed by a `MonoBehavior`, such as `ARPlaneManager`. This led to confusion about which object to interact with or subscribe to. Now, each subsystem has a manager component which not only provides access to that subsystem, but also manages its lifetime.
  42. If you previously used the `ARSubsystemManager`, look for similar functionality on one of the managers:
  43. | **1.0 subsystem** | **2.0 manager** |
  44. |-|-|
  45. | `XRPlaneSubsystem` | `ARPlaneManager` |
  46. | `XRReferencePointSubsystem` | `ARReferencePointManager` |
  47. | `XRDepthSubsystem` | `ARPointCloudManager` |
  48. | `XRSessionSubsystem` | `ARSession` |
  49. | `XRInputSubsystem` | `ARInputManager` (new) |
  50. | `XRCameraSubsystem` | `ARCameraManager` (new) |
  51. | `XRRaycastSubsystem` | `ARRaycastManager` (new) |
  52. ## ARInputManager
  53. Previously, pose tracking was implicitly always on. Now, you must have an `ARInputManager` component in your Scene to enable it. `ARInputManager` can be on any `GameObject`.
  54. The `ARInputManager` enables input tracking; the `TrackedPoseDriver` consumes pose data, as before.
  55. ## ARCameraManager and ARCameraOptions
  56. The `ARCameraManager` enables the `XRCameraSubsystem`. Without it, you can't use background rendering or obtain light estimation information. You should place this component on a Unity Camera, typically on the same one that is parented to the `ARSessionOrigin` and performs background rendering.
  57. The `ARCameraBackground` now requires an `ARCameraManager` component.
  58. The options that were previously on the `ARCameraOptions` component, like focus mode and light estimation mode, are now on the `ARCameraManager`. `ARCameraOptions` no longer exists.
  59. ## ARPointCloudManager
  60. In 1.0, the `ARPointCloudManager` managed a single point cloud. Now, it can manage a collection of them, similar to the way other trackable managers work. Some AR platforms, like ARCore and ARKit, still only have a single point cloud. However, other platforms (supported in the future) will generate multiple point clouds.
  61. As a result, the `ARPointCloudManager.pointCloud` property no longer exists. You can enumerate the point clouds like any other trackable manager, by iterating over its `trackables` property.
  62. ## ARRaycastManager
  63. The ray casting API is the same as before, but has moved to a new component, `ARRaycastManager`. Previously, it was on the `ARSessionOrigin`. If you need to perform a ray cast, make sure you have an `ARRaycastManager` on the same `GameObject` as the `ARSessionOrigin`, and use the `Raycast` methods on that component.