Beispiel #1
0
 // ComponentEnabled callback
 private void SpatialEntitySetComponentEnabled(UInt64 requestId, bool result, OVRPlugin.SpatialEntityComponentType componentType, ulong space)
 {
     if (locateAnchorRequest.ContainsKey(requestId) && !handleToAnchor.ContainsKey(locateAnchorRequest[requestId]))
     {
         CreateAnchorGameobject(locateAnchorRequest[requestId]);
     }
 }
Beispiel #2
0
    // Enables specified component if not already enabled
    private void tryEnableComponent(ulong anchorHandle, OVRPlugin.SpatialEntityComponentType type)
    {
        bool enabled;
        bool changePending;
        bool success = OVRPlugin.SpatialEntityGetComponentEnabled(ref anchorHandle, type, out enabled, out changePending);

        if (!success)
        {
            Log("WARNING SpatialEntityGetComponentEnabled did not complete successfully");
        }

        if (enabled)
        {
            Log("Component of type: " + type + " already enabled for anchorHandle: " + anchorHandle);
        }
        else
        {
            ulong requestId = 0;
            OVRPlugin.SpatialEntitySetComponentEnabled(ref anchorHandle, type, true, 0, ref requestId);
            Log("Enabling component for anchorHandle: " + anchorHandle + " type: " + type + " requestId " + requestId);
            switch (type)
            {
            case OVRPlugin.SpatialEntityComponentType.Locatable:
                locateAnchorRequest.Add(requestId, anchorHandle);
                break;

            case OVRPlugin.SpatialEntityComponentType.Storable:
                break;

            default:
                Log("Tried to enable component that's not supported");
                break;
            }
        }
    }