示例#1
0
        //Private Methods:
        private void GetPlanes()
        {
            MLWorldPlanesQueryParams query = new MLWorldPlanesQueryParams();

            query.MaxResults     = 50;
            query.MinPlaneArea   = .5f;
            query.Flags          = MLWorldPlanesQueryFlags.SemanticWall | MLWorldPlanesQueryFlags.SemanticFloor | MLWorldPlanesQueryFlags.SemanticCeiling;
            query.BoundsCenter   = _mainCamera.position;
            query.BoundsRotation = _mainCamera.rotation;
            query.BoundsExtents  = _planesQueryBoundsExtents;
            MLWorldPlanes.GetPlanes(query, HandlePlanes);
        }
    void Awake()
    {
        MLResult result = MLWorldPlanes.Start();

        if (!result.IsOk)
        {
            Debug.LogError("Error Planes starting MLWorldPlanes, disabling script.");
            enabled = false;
            return;
        }
        var queryParams = new MLWorldPlanesQueryParams();
        var queryFlags  = MLWorldPlanesQueryFlags.Horizontal;

        queryParams.Flags          = queryFlags;
        queryParams.MaxResults     = MAX_RESULTS;
        queryParams.BoundsCenter   = BBoxTransform.position;
        queryParams.BoundsRotation = BBoxTransform.rotation;
        queryParams.BoundsExtents  = BBoxExtents;
        MLWorldPlanes.GetPlanes(queryParams, HandleOnReceivedPlanes);
    }
示例#3
0
    void Awake()
    {
        MLResult hResult  = MLHands.Start();
        MLResult iResult  = MLInput.Start();
        MLResult pResult  = MLWorldPlanes.Start();
        MLResult wrResult = MLWorldRays.Start();

        if (
            !hResult.IsOk ||
            !iResult.IsOk ||
            !pResult.IsOk ||
            !wrResult.IsOk
            )
        {
            Debug.LogError("Error starting ML APIs, disabling script.");
            enabled = false;
            return;
        }

        // HANDS
        var enabledPoses = new MLHandKeyPose[] {
            MLHandKeyPose.Fist,
        };

        MLHands.KeyPoseManager.EnableKeyPoses(enabledPoses, true);

        // INPUT
        _iController = MLInput.GetController(MLInput.Hand.Left);

        // WORLD PLANES
        var queryParams = new MLWorldPlanesQueryParams();
        var queryFlags  = MLWorldPlanesQueryFlags.Horizontal | MLWorldPlanesQueryFlags.SemanticFloor;

        queryParams.Flags      = queryFlags;
        queryParams.MaxResults = WP_MAX_PLANES;
        MLWorldPlanes.GetPlanes(queryParams, HandleOnReceivedPlanes);

        // WORLD RAYS
        _wrBaseHeight      = transform.position.y;
        _wrLastCentimeters = (int)Math.Truncate(_wrBaseHeight * 100);
    }