/// <summary> /// Queries the Planes API with all of the set query flags and parameters /// and sets the Planes[] when finished. Based on the query flags that /// are passed in, extraction and calculation times may vary. /// </summary> private bool QueryPlanes() { // Construct flag data _queryFlags |= (MLWorldPlanesQueryFlags)OrientationFlags; _queryFlags |= (MLWorldPlanesQueryFlags)SemanticFlags; if (InnerPlanes) { _queryFlags |= MLWorldPlanesQueryFlags.Inner; } if (IgnoreHoles) { _queryFlags |= MLWorldPlanesQueryFlags.IgnoreHoles; } if (OrientToGravity) { _queryFlags |= MLWorldPlanesQueryFlags.OrientToGravity; } _queryParams.Flags = _queryFlags; _queryParams.BoundsCenter = transform.position; _queryParams.MaxResults = MaxPlaneCount; _queryParams.BoundsExtents = transform.localScale; _queryParams.BoundsRotation = transform.rotation; bool result = MLWorldPlanes.GetPlanes(_queryParams, HandleOnReceivedPlanes); if (result) { _isQuerying = true; return(true); } return(false); }
void RequestPlanes() { _queryParams.Flags = QueryFlags; _queryParams.MaxResults = 100; _queryParams.BoundsCenter = BBoxTransform.position; _queryParams.BoundsRotation = BBoxTransform.rotation; _queryParams.BoundsExtents = BBoxExtents; MLWorldPlanes.GetPlanes(_queryParams, OnReceivedPlanes); }
void RequestPlanes() { // Update the query parameters. _queryParams.Flags = QueryFlags; _queryParams.BoundsCenter = cameraTransform.position; _queryParams.BoundsRotation = cameraTransform.rotation; _queryParams.BoundsExtents = boundsExtents; // Make planes request with parameter list. MLWorldPlanes.GetPlanes(_queryParams, HandleOnReceivedPlanes); }
//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); }
private void requestPlanes() { //Sets parameters for planes searching //Debug.Log("Requesting planes"); _params.Flags = queryFlags; _params.MaxResults = 100; _params.BoundsCenter = boundingBoxTransform.position; _params.BoundsExtents = boundingBoxExtents; Debug.Log("Query params are " + _params.ToString()); Debug.Log("Trying to get planes"); //Callback to HandleReceivedPlanes MLWorldPlanes.GetPlanes(_params, HandleReceivedPlanes); Debug.Log("Finished GetPlanes() method"); }
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); }
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); }
/// <summary> /// Queries the Planes API with all of the set query flags and parameters /// and sets the Planes[] when finished. Based on the query flags that /// are passed in, extraction and calculation times may vary. /// </summary> private bool QueryPlanes() { // Construct flag data _queryFlags = (MLWorldPlanesQueryFlags)OrientationFlags; _queryFlags |= (MLWorldPlanesQueryFlags)SemanticFlags; if (InnerPlanes) { _queryFlags |= MLWorldPlanesQueryFlags.Inner; } if (IgnoreHoles) { _queryFlags |= MLWorldPlanesQueryFlags.IgnoreHoles; } if (OrientToGravity) { _queryFlags |= MLWorldPlanesQueryFlags.OrientToGravity; } _queryParams.Flags = _queryFlags; _queryParams.BoundsCenter = transform.position; _queryParams.MaxResults = MaxPlaneCount; _queryParams.BoundsExtents = transform.localScale; _queryParams.BoundsRotation = transform.rotation; _queryParams.MinHoleLength = MinHoleLength; _queryParams.MinPlaneArea = MinPlaneArea; MLResult result = MLWorldPlanes.GetPlanes(_queryParams, HandleOnReceivedPlanes); if (result.IsOk) { _isQuerying = true; return(true); } // TODO: Print result in failure case while preventing log spam. return(false); }