示例#1
0
 void Awake()
 {
     mappingManager    = GetComponentInChildren <SpatialMappingManager>();
     planesMaker       = GetComponentInChildren <SurfaceMeshesToPlanes>();
     verticesRemover   = GetComponentInChildren <RemoveSurfaceVertices>();
     horizontalObjects = new List <GameObject>();
     verticalObjects   = new List <GameObject>();
     otherObjects      = new List <GameObject>();
 }
示例#2
0
    // Use this for initialization
    void Start()
    {
        meshToPlanes = spatialProcessingObj.GetComponent <SurfaceMeshesToPlanes>();
        initializer  = initializeObj.GetComponent <Initialize>();

        meshToPlanes.MakePlanesComplete += SurfaceMeshesToPlanes_MakePlanesComplete;

        //spatialUnderstandingSource = spatialUnderStandingObj.GetComponent<SpatialUnderstandingSourceMesh>();
    }
    private void CreatePlanes()
    {
        SurfaceMeshesToPlanes surfaceToPlanes = SurfaceMeshesToPlanes.Instance;

        if (surfaceToPlanes != null && surfaceToPlanes.enabled)
        {
            surfaceToPlanes.MakePlanes();
        }
    }
    private void MyMakePlanes()
    {
        SurfaceMeshesToPlanes meshToPlanes = SurfaceMeshesToPlanes.Instance;

        if (null != meshToPlanes && meshToPlanes.enabled)
        {
            meshToPlanes.MakePlanes();
        }
    }
    /// <summary>
    /// Creates planes from the spatial mapping surfaces.
    /// </summary>
    private void CreatePlanes()
    {
        // Generate planes based on the spatial map.
        SurfaceMeshesToPlanes surfaceToPlanes = SurfaceMeshesToPlanes.Instance;

        if (surfaceToPlanes != null && surfaceToPlanes.enabled)
        {
            surfaceToPlanes.MakePlanes();
        }
    }
    /// <summary>
    /// Creates planes from the spatial mapping surfaces.
    /// </summary>
    private void CreatePlanes()
    {
        // Generate planes based on the spatial map.
        SurfaceMeshesToPlanes surfaceToPlanes = SurfaceMeshesToPlanes.Instance;

        if (surfaceToPlanes != null && surfaceToPlanes.enabled)
        {
            surfaceToPlanes.MakePlanes();
        }
        Debug.Log("CREATING PLANES COMPLETE");
    }
示例#7
0
    /// <summary>
    /// Creates planes from the spatial mapping surfaces.
    /// </summary>
    private void CreatePlanes()
    {
        // Generate planes based on the spatial map.
        SurfaceMeshesToPlanes surfaceToPlanes = SurfaceMeshesToPlanes.Instance;

        Debug.Log("CreatePlanes : " + surfaceToPlanes.enabled);
        if (surfaceToPlanes != null && surfaceToPlanes.enabled)
        {
            Debug.Log("MakePlanes");
            surfaceToPlanes.MakePlanes();
        }
    }
    // Use this for initialization
    private void Start()
    {
        // Get Instance of SpatialMappingManager
        spatialMappingManager = SpatialMappingManager.Instance;

        surfaceMeshesToPlanes = SurfaceMeshesToPlanes.Instance;

        // Start to recognize gestures
        gestureRecognizer = new GestureRecognizer();
        gestureRecognizer.SetRecognizableGestures(GestureSettings.Tap);

        removeVerts = RemoveSurfaceVertices.Instance;
    }
示例#9
0
    private void OnTapEvent(InteractionSourceKind source, int tap_count, Ray head_ray)
    {
        switch (m_state)
        {
        case State.Scanning:
            // Stop scanning and detect planes
            if (SpatialMappingManager.Instance.IsObserverRunning())
            {
                SpatialMappingManager.Instance.StopObserver();
            }
            SurfaceMeshesToPlanes planeDetector = SurfaceMeshesToPlanes.Instance;
            planeDetector.MakePlanesComplete += OnPlanesComplete;
            planeDetector.MakePlanes();
            m_state = State.Playing;
            break;

        case State.Playing:
            RaycastHit hit;
            if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit))
            {
                // If a wall, floor, or ceiling was hit, embed a bullet hole
                GameObject target = hit.collider.gameObject;
                Debug.Log("Hit: " + target.name);
                SurfacePlane plane = target.GetComponent <SurfacePlane>();
                if (plane != null)
                {
                    if (plane.PlaneType == PlaneTypes.Ceiling ||
                        plane.PlaneType == PlaneTypes.Floor ||
                        plane.PlaneType == PlaneTypes.Wall)
                    {
                        CreateBulletHole(hit.point, hit.normal, plane);
                    }
                }
            }
            break;
        }
    }