コード例 #1
0
        public void ShowAllColliderWithPropsAndCondition(uint[] props, ColliderCondition condition = ColliderCondition.NONE, Vector3 testPos = new Vector3())
        {
            _tempList.Clear();
            HideAllColliderRenderers();

            GetColliderWithPropsAndCondition(props, condition, testPos);

            // draw
            int num = _tempList.Count;

            for (int i = 0; i < num; ++i)
            {
                MeshRenderer rnd = _tempList[i].GetComponent <MeshRenderer>();
                if (rnd == null)
                {
                    rnd = _tempList[i].gameObject.AddComponent <MeshRenderer>();
                }

                Material wireframe = new Material(Shader.Find("ViveSR/Wireframe"));
                wireframe.SetFloat("_ZTest", 0);
                wireframe.SetFloat("_Thickness", 0);
                rnd.sharedMaterial = wireframe;
                rnd.enabled        = true;
            }
        }
コード例 #2
0
        public ViveSR_StaticColliderInfo[] GetColliderWithPropsAndCondition(uint[] props, ColliderCondition condition, Vector3 testPos = new Vector3())
        {
            if (condition == ColliderCondition.NONE)
            {
                return(GetAllColliderHasProps(props));
            }

            ViveSR_StaticColliderInfo info = null;

            if (condition == ColliderCondition.LARGEST)
            {
                info = GetLargestCollider(props);
            }
            else if (condition == ColliderCondition.CLOSEST)
            {
                info = GetClosestColliderWithProps(testPos, props);
            }
            else if (condition == ColliderCondition.FURTHEST)
            {
                info = GetFurthestColliderWithProps(testPos, props);
            }

            _tempList.Clear();
            if (info)
            {
                _tempList.Add(info);
            }

            return(_tempList.ToArray());
        }