示例#1
0
    public override ulong CreateSpatialAnchor(Transform T_UnityWorld_Anchor)
    {
        OVRPlugin.SpatialEntityAnchorCreateInfo createInfo = new OVRPlugin.SpatialEntityAnchorCreateInfo()
        {
            Time         = OVRPlugin.GetTimeInSeconds(),
            BaseTracking = OVRPlugin.GetTrackingOriginType(),
            PoseInSpace  = OVRExtensions.ToOVRPose(T_UnityWorld_Anchor, false).ToPosef()
        };

        ulong anchorHandle = AnchorSession.kInvalidHandle;

        if (OVRPlugin.SpatialEntityCreateSpatialAnchor(createInfo, ref anchorHandle))
        {
            Log("Spatial anchor created with handle: " + anchorHandle);
        }
        else
        {
            Log("OVRPlugin.SpatialEntityCreateSpatialAnchor failed");
        }

        tryEnableComponent(anchorHandle, OVRPlugin.SpatialEntityComponentType.Locatable);
        tryEnableComponent(anchorHandle, OVRPlugin.SpatialEntityComponentType.Storable);

        return(anchorHandle);
    }