void ResetObjects()
 {
     SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
     foreach (GameObject g in GameObject.FindGameObjectsWithTag("TestCube"))
     {
         Destroy(g);
     }
 }
 public void ClearGeometry(bool clearAll = true)
 {
     placementResults.Clear();
     if (SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
     {
         SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
     }
     SpatialScanManager.Instance.ObjectPlacementDescription = "";
 }
Exemple #3
0
    void Reset()
    {
        queryPlacementResults.Clear();

        if (SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
        {
            SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
        }
    }
Exemple #4
0
        public void ClearGeometry(bool clearAll = true)
        {
            placementResults.Clear();
            if (SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
            {
                SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
            }
            AppState.Instance.ObjectPlacementDescription = "";

            if (clearAll && (SpaceVisualizer.Instance != null))
            {
                SpaceVisualizer.Instance.ClearGeometry(false);
            }
        }
Exemple #5
0
 //TODO: add a function to remove individual placements based on token
 public void ClearPlacements()
 {
     SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
     m_platformPlacements.Clear();
 }
Exemple #6
0
    //Examples of ways to et locations and store them in location list.
    private IEnumerator GetSpawnLocations()
    {
        yield return(new WaitForSeconds(3));

        //IntPtr resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
        //int locationCount = SpatialUnderstandingDllTopology.QueryTopology_FindLargestPositionsOnFloor(
        //    resultsTopology.Length, resultsTopologyPtr);
        //Debug.Log(locationCount);
        //Debug.Log(resultsTopology[0].position);

        //END OF TEST EXAMPLES.. FINDING LOCATIONS FOR THE FLOOR NOW.
        SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
        SpaceVisualizer.Instance.ClearGeometry();
        IntPtr resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
        int    locationCount      = SpatialUnderstandingDllTopology.QueryTopology_FindPositionsOnFloor(
            GameManager.Instance.shipManager.shipMaxHeight, GameManager.Instance.shipManager.shipMinHeight,
            resultsTopology.Length, resultsTopologyPtr);

        foreach (SpatialUnderstandingDllTopology.TopologyResult potentialShipFloor in resultsTopology)
        {
            SpatialLocation shipFloor = new SpatialLocation();
            shipFloor.position = potentialShipFloor.position;
            shipFloor.normal   = potentialShipFloor.normal;
            shipFloor.name     = "shipFloor"; // this sould be a descriptive name of what positin is.
            spatialLocationList.Add(shipFloor);
        }

        // GETTING SPAWN LOCATION FOR GRID
        //    SpaceVisualizer.Instance.ClearGeometry();
        //    resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
        //    locationCount = SpatialUnderstandingDllTopology.QueryTopology_FindLargestPositionsOnFloor(
        //resultsTopology.Length, resultsTopologyPtr);

        //    SpatialLocation gridSittingLoc = new SpatialLocation();
        //    gridSittingLoc.position = resultsTopology[0].position;
        //    gridSittingLoc.normal = resultsTopology[0].normal;
        //    gridSittingLoc.name = "gridSittingLoc"; // this sould be a descriptive name of what positin is.
        //    spatialLocationList.Add(gridSittingLoc);


        //SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
        //SpaceVisualizer.Instance.ClearGeometry();
        //float sitMinHeight = 0f;
        //float sitMaxHeight = 1.2f;
        //float sitMinFacingClearance = 2f;
        //SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
        //resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
        //int locationCount3 = SpatialUnderstandingDllTopology.QueryTopology_FindPositionsSittable(
        //    sitMinHeight, sitMaxHeight, sitMinFacingClearance,
        //    resultsTopology.Length, resultsTopologyPtr);
        //SpatialLocation gridSittingLoc = new SpatialLocation();
        //gridSittingLoc.position = resultsTopology[0].position;
        //gridSittingLoc.normal = resultsTopology[0].normal;
        //gridSittingLoc.name = "gridSittingLoc"; // this sould be a descriptive name of what positin is.
        //spatialLocationList.Add(gridSittingLoc);



        SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects();
        SpaceVisualizer.Instance.ClearGeometry();
        IntPtr resultsShapePtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsShape);
        int    shapeCount      = SpatialUnderstandingDllShapes.QueryShape_FindShapeHalfDims(
            "Grid",
            resultsShape.Length, resultsShapePtr);

        Debug.Log(resultsShape[0].position);
        Debug.Log(resultsShape[0].halfDims);
        SpatialLocation gridSittingLoc = new SpatialLocation();

        gridSittingLoc.position = resultsShape[0].position;
        gridSittingLoc.normal   = resultsShape[0].halfDims;
        gridSittingLoc.name     = "gridSittingLoc"; // this sould be a descriptive name of what positin is.
        spatialLocationList.Add(gridSittingLoc);
        yield return(null);
    }