예제 #1
0
    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < 9; i++)
        {
            Vector3 p = leapOffset + rotation * points[i];
            objs[i].transform.position = ToUnityCoords(points[i]);//mainCamera.transform.position + mainCamera.transform.rotation * p;
        }

        //finds angle for area that the UI for the left hand will be visible
        if (Vector3.angle(points[1], -mainCamera.transform.forward) < 20.0f)
        {
            //sets the UI as visible when the parameters are met
            UIleft.setActive(true);
        }
        else
        {
            //sets the UI as invisible when the parameters are met
            UIleft.setActive(false);
        }

        //finds angle for the area that the UI for the right hand will be visible
        if (Vector3.angle(points[3], -mainCamera.transform.forward) < 20.0f)
        {
            //sets the UI as visible when the parameters are met
            UIright.setActive(true);
        }
        else
        {
            //sets the UI as invisible when the parameters are met
            UIright.setActive(false);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        //Defaults the UI to be Invisible
        UIright.setActive(false);
        UIleft.setActive(false);
        //Server Manager Object
        cbm = new ClientBTManager();
        //Packets
        cbm.PacketReceived += Recieved;
        //connected
        cbm.Connected += OnConnect;
        cbm.Initialize();

        mainCamera = Camera.main;
        //gives indexed for each index
        points = new Vector3[9];
        objs   = new GameObject[9];

        //fills each vector array
        for (int i = 0; i < 9; i++)
        {
            //creates a sphere
            objs[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            //size of the object
            objs[i].transform.localScale = new Vector3(0.02f, 0.02f, 0.02f);
        }
    }