예제 #1
0
    void Start()
    {
        ramaPlot = GameObject.Find("RamaPlotOrigin");

        myPlotCube      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        myPlotCube.name = "PlotCube";
        myPlotCube.GetComponent <Collider>().isTrigger = true;
        myPlotCube.GetComponent <Collider>().enabled   = false;
        myPlotCube.transform.parent     = gameObject.transform;
        myPlotCube.transform.localScale = myPlotCubeBaseScale;
        myPlotCube.transform.rotation   = ramaPlot.transform.rotation;
        myPlotCube.transform.position   = ramaPlot.transform.position;

        Renderer myRenderer = myPlotCube.GetComponent <Renderer>();

        myRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        myRenderer.receiveShadows    = false;


        myLabel      = Instantiate(Label_pf, transform);
        myLabel.name = "residueLabel";

        myPlotCubeLabel      = Instantiate(Label_pf, transform);
        myPlotCubeLabel.name = "plotCubeLabel";

        myPlotCubeLabel.GetComponent <TextMesh>().color         = Color.black;
        myPlotCubeLabel.GetComponent <TextMesh>().characterSize = 0.0008f;
        myPlotCubeLabel.GetComponent <TextMesh>().fontSize      = 300;
        myPlotCubeLabel.GetComponent <TextMesh>().fontStyle     = FontStyle.Bold;
        myPlotCubeLabel.GetComponent <TextMesh>().anchor        = TextAnchor.MiddleCenter;

        myPeptidePlane = carbonyl_pf.transform.Find("tf_bond_C_N/bond_CO_N/PeptidePlane").gameObject;

        // is terminal residue ?
        if (resid == 0)
        {
            isNTerminal = true;
        }
        if (resid == (myPolyPepBuilder.GetComponent <PolyPepBuilder>().numResidues - 1))
        {
            isCTerminal = true;
        }

        // store references to backbone atom transforms
        N  = amide_pf.transform.Find("N_amide");
        HN = amide_pf.transform.Find("tf_H/H_amide");
        C  = carbonyl_pf.transform.Find("C_carbonyl");
        O  = carbonyl_pf.transform.Find("tf_O/O_carbonyl");

        backboneAtomsList.Add(N);
        backboneAtomsList.Add(HN);
        backboneAtomsList.Add(C);
        backboneAtomsList.Add(O);
    }
예제 #2
0
파일: Residue.cs 프로젝트: yakomaxa/molpath
    void Start()
    {
        ramaPlotOrigin = GameObject.Find("RamaPlotOrigin_tf");

        myPlotCube      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        myPlotCube.name = "PlotCube";
        myPlotCube.GetComponent <Collider>().isTrigger = true;
        myPlotCube.GetComponent <Collider>().enabled   = false;
        myPlotCube.transform.parent     = gameObject.transform;
        myPlotCube.transform.localScale = myPlotCubeBaseScale;
        myPlotCube.transform.rotation   = ramaPlotOrigin.transform.rotation;
        myPlotCube.transform.position   = ramaPlotOrigin.transform.position;



        Renderer myRenderer = myPlotCube.GetComponent <Renderer>();

        myRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        myRenderer.receiveShadows    = false;


        myLabel      = Instantiate(Label_pf, transform);
        myLabel.name = "residueLabel";

        myLabelTMP      = Instantiate(LabelTMP_pf, transform);
        myLabelTMP.name = "residueLabelTMP";

        myLabel.SetActive(false);
        myLabelTMP.SetActive(false);

        myPlotCubeLabel      = Instantiate(Label_pf, transform);
        myPlotCubeLabel.name = "plotCubeLabel";

        // plot particle trail
        // note: particle alpha in build is different from in editor
        // bug? material? shader?
        // for the moment compromise is to have trails with reasonable alpha in build
        // which means they are almost invisible in editor
        myPlotTrail_ps                      = Instantiate(plotTrail_ps, myPlotCube.transform);
        myTrailPsMain                       = myPlotTrail_ps.main;
        myTrailPsMain.startSize             = 0.02f;
        myTrailPsMain.customSimulationSpace = ramaPlotOrigin.transform;
        ParticleSystem.EmissionModule psEmission = myPlotTrail_ps.emission;
        psEmission.rateOverTime = 200;

        myPlotCubeLabel.GetComponent <TextMesh>().color         = Color.black;
        myPlotCubeLabel.GetComponent <TextMesh>().characterSize = 0.0008f;
        myPlotCubeLabel.GetComponent <TextMesh>().fontSize      = 300;
        myPlotCubeLabel.GetComponent <TextMesh>().fontStyle     = FontStyle.Bold;
        myPlotCubeLabel.GetComponent <TextMesh>().anchor        = TextAnchor.MiddleCenter;

        myPeptidePlane = carbonyl_pf.transform.Find("tf_bond_C_N/bond_CO_N/PeptidePlane").gameObject;

        // is terminal residue ?
        if (resid == 0)
        {
            isNTerminal = true;
        }
        if (resid == (myPolyPepBuilder.GetComponent <PolyPepBuilder>().numResidues - 1))
        {
            isCTerminal = true;
        }

        // store references to backbone atom transforms
        N  = amide_pf.transform.Find("N_amide");
        HN = amide_pf.transform.Find("tf_H/H_amide");
        C  = carbonyl_pf.transform.Find("C_carbonyl");
        O  = carbonyl_pf.transform.Find("tf_O/O_carbonyl");

        backboneAtomsList.Add(N);
        backboneAtomsList.Add(HN);
        backboneAtomsList.Add(C);
        backboneAtomsList.Add(O);
    }