Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < 10; i++)
        {
            var tempSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            tempSphere.transform.position = new Vector3(Random.Range(-1f, 1f), i, 0);
            leftControlePts.Add(tempSphere);
        }
        for (int j = 0; j < 10; j++)
        {
            var tempSphere1 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            tempSphere1.transform.position = new Vector3(5 + Random.Range(-1f, 1f), j, 0);
            rightControlePts.Add(tempSphere1);
        }

        foreach (var sphere in leftControlePts)
        {
            leftControleVec.Add(sphere.transform.position);
        }

        foreach (var sphere in rightControlePts)
        {
            rightControleVec.Add(sphere.transform.position);
        }

        var filter = GetComponent <MeshFilter>();

        bottleMesh = new BottleMesh(filter);
        bottleMesh.CreateMesh(leftControleVec, rightControleVec);
        GetComponent <MeshRenderer>().material = mat;
    }
Esempio n. 2
0
    private void Start()
    {
        predictor = GetComponent <Predictor>();
        InitializeBottle();
        bottleMesh = new BottleMesh(GetComponent <MeshFilter>());
        bottleMesh.CreateMesh(leftCtlPos, rightCtlPos);

        int agentNum = int.Parse(gameObject.name.Split('(')[1].Split(')')[0]);

        Debug.Log(agentNum);
        predictor.inputTexture = renderTextures[agentNum];
        GetComponentInChildren <Camera>().targetTexture = renderTextures[agentNum];
    }