Esempio n. 1
0
    private void Update()
    {
        if (mode == 0 && (gripped == 1))
        {
            Vector3 ang = _controller.transform.eulerAngles;
            ang.x += -90;
            mol.transform.eulerAngles = ang;
        }

        if (mode == 3 && (gripped == 1))
        {
            if (searched == 0)
            {
                xb       = MoleculeLoader.findMole(transform.position);
                searched = 1;
            }
            //xb.pos = _controller.transform.position;
            xb.sphere.transform.position = _controller.transform.position;
        }
    }
Esempio n. 2
0
    private void HandleTriggerClicked(object sender, ClickedEventArgs e)
    {
        MoleculeLoader.atom_info x = MoleculeLoader.findMole(transform.position);
        tvNameText.text = x.name;

        switch (x.name)
        {
        case "Pb":
            tvRadiusText.text = "1.47" + " Å";
            tvWeightText.text = "207.2";
            break;

        case "I":
            tvRadiusText.text = "1.33" + " Å";
            tvWeightText.text = "126.904";
            break;

        case "C":
            tvRadiusText.text = "0.77" + " Å";
            tvWeightText.text = "12.011";
            break;

        case "H":
            tvRadiusText.text = "0.37" + " Å";
            tvWeightText.text = "1.008";
            break;

        case "N":
            tvRadiusText.text = "0.75" + " Å";
            tvWeightText.text = "14.007";
            break;

        case "Zn":
            tvRadiusText.text = "1.31" + " Å";
            tvWeightText.text = "65.38";
            break;

        case "Cu":
            tvRadiusText.text = "1.38" + " Å";
            tvWeightText.text = "63.546";
            break;

        case "S":
            tvRadiusText.text = "1.02" + " Å";
            tvWeightText.text = "32.06";
            break;

        default:
            tvRadiusText.text = "1" + " Å";
            tvWeightText.text = "10";
            break;
        }


        // Rotate Entire Molecule
        if (mode == 0)
        {
            // Code is in update
        }

        // Get Distance Between 2
        if (mode == 1)
        {
            if (f1 == 0)
            {
                a1 = x;
                f1 = 1;
            }
            else
            {
                a2 = x;
                f2 = 1;
            }
            if ((f1 == 1) && (f2 == 1))
            {
                f1 = 0;
                f2 = 0;
                tvModeValueText.text = (Vector3.Distance(a1.pos, a2.pos) * 22).ToString() + " Å";
            }
        }

        // Get Angle Between 3
        if (mode == 2)
        {
            if (f1 == 0)
            {
                a1 = x;
                f1 = 1;
            }
            else if ((f2 == 0) && (f1 == 1))
            {
                a2 = x;
                f2 = 1;
            }
            else if ((f2 == 1) && (f1 == 1))
            {
                a3 = x;
                f3 = 1;
            }
            if ((f1 == 1) && (f2 == 1) && (f3 == 1))
            {
                f1 = 0;
                f2 = 0;
                f3 = 0;
                Vector3 AB = a1.pos - a2.pos;
                Vector3 BC = a3.pos - a2.pos;

                tvModeValueText.text = Vector3.Angle(AB, BC).ToString() + " °";
            }
        }

        // Move single molecule and then redraw bonds
        if (mode == 3)
        {
        }

        if (mode == 4)
        {
            MoleculeLoader.writeXYZ();
        }
    }