Beispiel #1
0
    // Use this for initialization

    void Start()
    {
        if (!rb)
        {
            rb = gameObject.GetComponent <Rigidbody>();
        }
        //
        myPPBChain = residueGO.GetComponent <Residue>().myPolyPepBuilder;
        resid      = residueGO.GetComponent <Residue>().resid;
        if (rb.tag == "amide")
        {
            isBBAmide = true;
        }
        if (rb.tag == "carbonyl")
        {
            isBBCarbonyl = true;
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Awake()
    {
        // init my references to renderers
        {
            Renderer[] allChildRenderers = gameObject.GetComponentsInChildren <Renderer>();
            foreach (Renderer childRenderer in allChildRenderers)
            {
                //Debug.Log(childRenderer.transform.gameObject.name);
                //Debug.Log(childRenderer.transform.gameObject.layer);

                //bonds
                if (childRenderer.transform.gameObject.name == "bond_N_CA")
                {
                    rendererPhi = childRenderer;
                }
                if (childRenderer.transform.gameObject.name == "bond_CA_CO")
                {
                    rendererPsi = childRenderer;
                }
                if (childRenderer.transform.gameObject.name == "bond_CO_N")
                {
                    rendererPeptide = childRenderer;
                }

                //atoms
                if (childRenderer.transform.gameObject.layer == LayerMask.NameToLayer("Atom"))
                {
                    //Debug.Log("got one!");
                    renderersAtoms.Add(childRenderer);
                }
            }
            //Debug.Log("bu " + gameObject + " --> " + gameObject.transform.parent.parent.gameObject);
        }

        // init parent script references
        myResidue        = (gameObject.transform.parent.gameObject.GetComponent("Residue") as Residue);
        myPolyPepBuilder = (gameObject.transform.parent.parent.gameObject.GetComponent("PolyPepBuilder") as PolyPepBuilder);
        GameObject manager = GameObject.Find("PolyPepManager");

        myPolyPepManager = manager.GetComponent("PolyPepManager") as PolyPepManager;

        shaderStandard    = Shader.Find("Standard");
        shaderToonOutline = Shader.Find("Toon/Basic Outline");
    }
Beispiel #3
0
    public void SpawnPolypeptide(Transform spawnTransform)
    {
        //if (!collidersOn)
        {
            int numResidues = (int)spawnLengthSliderUI.GetComponent <Slider>().value;
            //Debug.Log(spawnTransform.position);

            Vector3 offset = -spawnTransform.transform.right * (numResidues - 1) * 0.2f;
            // offset to try to keep new pp in sensible position
            // working solution - no scale, centre of mass / springs ...
            //spawnTransform.transform.position += offset; // NO! this is a reference not a copy!
            GameObject     ppb    = Instantiate(polyPepBuilder_pf, spawnTransform.transform.position + offset, Quaternion.identity);
            PolyPepBuilder ppb_cs = ppb.GetComponent <PolyPepBuilder>();
            ppb_cs.numResidues      = numResidues;
            ppb_cs.myPolyPepManager = GetComponent <PolyPepManager>();
            ppb.name = "polyPep_" + allPolyPepBuilders.Count;
            allPolyPepBuilders.Add(ppb_cs);

            ppb_cs.sideChainBuilder = sideChainBuilder;
        }
    }