Compartir a través de


AnchorConverter.CreateFromPerceptionSpatialAnchor(Object) Method

Definition

Creating a new ARAnchor from the given Windows.Perception.Spatial.SpatialAnchor. If failed, the function returns TrackableId.invalidId. Creates an OpenXR anchor from a Windows.Perception.Spatial.SpatialAnchor and reports it to Unity.

public static UnityEngine.XR.ARSubsystems.TrackableId CreateFromPerceptionSpatialAnchor (object spatialAnchor);
static member CreateFromPerceptionSpatialAnchor : obj -> UnityEngine.XR.ARSubsystems.TrackableId
Public Shared Function CreateFromPerceptionSpatialAnchor (spatialAnchor As Object) As TrackableId

Parameters

spatialAnchor
Object

Must be a Windows.Perception.Spatial.SpatialAnchor.

Returns

UnityEngine.XR.ARSubsystems.TrackableId

Returns the trackable id representing the Unity anchor or UnityEngine.XR.ARSubsystems.TrackableId.invalidId if the conversion was unsuccessful.

Remarks

The newly created TrackableId will not be added to UnityEngine.XR.ARFoundation.ARTrackableManager`5.trackables collection until the next frame's Update. The app should listen to the UnityEngine.XR.ARFoundation.ARAnchorManager.anchorsChanged event for the added ARAnchor object with the returned trackableId.

Applies to