Ejemplo n.º 1
0
 private void _SetSemanticColliderVisible(bool isVisible)
 {
     foreach (GameObject go in semanticList)
     {
         if (go == null)
         {
             continue;
         }
         ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();
         if (isVisible)
         {
             if (pool == null)
             {
                 _WaitForSemanticCldPoolToShow(go);
             }
             else
             {
                 pool.ShowAllColliderWithPropsAndCondition(new uint[] { (uint)ColliderShapeType.MESH_SHAPE });
             }
         }
         else
         {
             if (pool != null)
             {
                 pool.HideAllColliderRenderers();
             }
         }
     }
 }
Ejemplo n.º 2
0
        IEnumerator _CoroutineWaitForSemanticCldPoolToShow(GameObject go)
        {
            ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();

            while (pool == null)
            {
                pool = collisionMesh.GetComponent <ViveSR_StaticColliderPool>();
                yield return(new WaitForEndOfFrame());
            }
            pool.ShowAllColliderWithPropsAndCondition(new uint[] { (uint)ColliderShapeType.MESH_SHAPE });
        }
Ejemplo n.º 3
0
        IEnumerator _CoroutineWaitForSemanticCldPool(GameObject go, System.Action done = null)
        {
            ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();

            while (pool == null)
            {
                pool = go.GetComponent <ViveSR_StaticColliderPool>();
                yield return(new WaitForEndOfFrame());
            }
            done();
        }
Ejemplo n.º 4
0
        public void ResetTile(ViveSR_StaticColliderPool cld_pool)
        {
            // Reset collider pool
            //cldPool = cld_pool;

            //// Reset tile rotation
            //floor = cldPool.GetFloorCollider(ColliderShapeType.MESH_SHAPE);
            //ViveSR_StaticColliderInfo bb_cldInfo = floor.GetCorrespondingColliderOfType(ColliderShapeType.BOUND_RECT_SHAPE);
            //if (bb_cldInfo == null) return;

            //right4FloatingTile = bb_cldInfo.RectRightAxis;
            //up4FloatingTile = bb_cldInfo.GroupNormal;
            //forward4FloatingTile = Vector3.Cross(right4FloatingTile, up4FloatingTile);
            //floatingTile.transform.LookAt(forward4FloatingTile, up4FloatingTile);
        }
Ejemplo n.º 5
0
 public void ShowSemanticColliderByType(SceneUnderstandingObjectType type)
 {
     foreach (GameObject go in semanticList)
     {
         ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();
         if (type != SceneUnderstandingObjectType.NONE && pool.GetSemanticType() == type)
         {
             if (pool == null)
             {
                 _WaitForSemanticCldPoolToShow(go);
             }
             else
             {
                 pool.ShowAllColliderWithPropsAndCondition(new uint[] { (uint)ColliderShapeType.MESH_SHAPE });
             }
         }
     }
 }
        private void LoadColliderDoneCallBack(GameObject go, string semanticFileName, bool updateIsReady)
        {
            if (ViveSR_StaticColliderPool.ProcessDataAndGenColliderInfo(go) == true)
            {
                ViveSR_StaticColliderPool cldPool = go.AddComponent <ViveSR_StaticColliderPool>();
                Rigidbody rigid = go.AddComponent <Rigidbody>();
                rigid.isKinematic = true;
                rigid.useGravity  = false;

                cldPool.OrganizeHierarchy();

                cldRnds = go.GetComponentsInChildren <MeshRenderer>(true);
            }
            if (updateIsReady)
            {
                isColliderReady = true;
            }
        }
Ejemplo n.º 7
0
        public void ShowSemanticColliderByType(SceneUnderstandingObjectType type)
        {
            if (type == SceneUnderstandingObjectType.NONE)
            {
                return;
            }

            foreach (GameObject go in semanticList)
            {
                WaitForSemanticCldPool(go, () => {
                    ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();
                    {
                        if (pool.GetSemanticType() == type)
                        {
                            pool.ShowAllColliderWithPropsAndCondition(new uint[] { (uint)ColliderShapeType.MESH_SHAPE });
                        }
                    }
                });
            }
        }
Ejemplo n.º 8
0
        public GameObject[] GetSemanticObjects(SceneUnderstandingObjectType type)
        {
            List <GameObject> objList = new List <GameObject>();

            if (type != SceneUnderstandingObjectType.NONE)
            {
                foreach (GameObject go in semanticList)
                {
                    ViveSR_StaticColliderPool pool = go.GetComponent <ViveSR_StaticColliderPool>();
                    if (pool == null)
                    {
                        Debug.Log("[SemanticSegmentation] Semantic object is not loaded completely.");
                        break;
                    }
                    if (pool.GetSemanticType() == type)
                    {
                        objList.Add(go);
                    }
                }
            }
            return(objList.ToArray());
        }
 public void SetCldPool(ViveSR_StaticColliderPool cld_pool)
 {
     cldPool = cld_pool;
 }