void OnDestroy() { MLHands.Stop(); MLInput.Stop(); MLWorldPlanes.Stop(); MLWorldRays.Stop(); }
/// <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); }
/// <summary> /// Stops and destroys plane polling /// </summary> void OnDisable() { if (MLWorldPlanes.IsStarted) { MLWorldPlanes.Stop(); } }
// Start is called before the first frame update void Start() { if (!MLWorldPlanes.Start().IsOk) { Debug.LogWarning("MLPlanes failed to start correctly"); } }
//Init: private void Start() { Initialize(); //start planes: MLWorldPlanes.Start(); GetPlanes(); }
/// <summary> /// Initializes variables and makes sure they started correctly /// </summary> void OnEnable() { if (!MLWorldPlanes.Start()) { Debug.LogError("Error Planes starting MLWorldPlanes, disabling script."); enabled = false; return; } }
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); }
/// <summary> /// Initializes variables and makes sure they started correctly /// </summary> void OnEnable() { MLResult result = MLWorldPlanes.Start(); if (!result.IsOk) { Debug.LogError("Error Planes starting MLWorldPlanes, disabling script."); enabled = false; return; } }
void Start() { // Start Planes. MLWorldPlanes.Start(); // The max number of planes returned by the query. _queryParams.MaxResults = 1; // Set the Planes Request to repeat every 5 secs. InvokeRepeating("RequestPlanes", 1f, 5f); }
//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 Start() { MLWorldPlanes.Start(); Debug.Log("Started MLWorldPlanes"); //requestPlanes(); //List<float> distancesNonFloorPlanes = new List<float>(); //Debug.Log("Above floors list has " + _aboveFloorList.Count + " planes"); //for(int i = 0; i < _aboveFloorList.Count; i++) //{ // distancesNonFloorPlanes.Add(Vector3.Distance(Camera.main.transform.position, _aboveFloorList[i].transform.position)); //} //int minValueIndex = distancesNonFloorPlanes.IndexOf(distancesNonFloorPlanes.Min()); //playerInstantiationPosition = _aboveFloorList[minValueIndex].transform.position; }
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); }
// Start is called before the first frame update void Start() { // Start Plane Extraction MLWorldPlanes.Start(); }
/// <summary> /// Stops and destroys plane polling /// </summary> void OnDisable() { MLWorldPlanes.Stop(); }
private void OnDestroy() { MLWorldPlanes.Stop(); }
// Use this for initialization void Start() { MLWorldPlanes.Start(); PlanePrefab.SetActive(false); }
void onDestroy() { // Stop Plane Extraction MLWorldPlanes.Stop(); }
// Use this for initialization void Start() { MLWorldPlanes.Start(); }