在滑动3D模型(Cube)时,手指点击进入相应的某一部分

 public void OnClickRay()
    {
        Ray ray = new Ray();
        RaycastHit shootHit;
        ray.origin = cameras.transform.position;
        ray.direction =cubes.transform.position-cameras.transform.position;
        if(Physics.Raycast(ray,out shootHit))
        {
            string ShitName = shootHit.collider.gameObject.name;
            if (ShitName == "4GCUbe")
            {
                ShowUI(UI.RESULT);
                ShowChild(Access4G, "4GAccess");            
            }
            else if(ShitName== "5GCUbe")
            {
                ShowUI(UI.INPUTNAME);
                ShowChild(Access5G, "5GAccess");
              
            }
            else if(ShitName== "IndoorCUbe")
            {
                ShowUI(UI.FORU);
                PassiveeDistrbution.SetActive(false);
                ShowChild(ActiveDistrbution, "Active Distribution");

            }
            else if(ShitName == "SateelliteCUbe")
            {
                ShowUI(UI.FOTDS);
                ShowChild(Satilite, "Satilite");

            }

        }
        
    }

  

通过射线判断点击的是哪一部分

猜你喜欢

转载自www.cnblogs.com/clhxxlcj/p/10916738.html