Exemplo n.º 1
0
    public void Update()
    {
        if (this.oculusTouch.GetButton(this.button1) || this.oculusTouch.GetButton(this.button2))
        {
            //this.intersectionManager.Update();
            if (!this.HaveInterSections()) //this.intersectionManager.HaveInterSections())
            {
                Moebius moebius = new Moebius(newCurves);
                if (this.oculusTouch.GetButton(this.button1))
                {
                    moebius.Flow();
                }
                else if (this.oculusTouch.GetButton(this.button2))
                {
                    moebius.MomentumFlow();
                }

                foreach (Curve curve in this.newCurves)
                {
                    while (true)
                    {
                        Elasticity elasticity = new Elasticity(curve.points, curve.momentum, curve.segment);
                        if (elasticity.MaxError() < curve.segment * 0.2f)
                        {
                            break;
                        }
                        elasticity.Flow();
                    }
                }
            }
        }

        if (this.oculusTouch.GetButtonUp(this.button2))
        {
            foreach (Curve curve in this.newCurves)
            {
                curve.MomentumInitialize();
            }
        }

        foreach (Curve curve in this.newCurves)
        {
            curve.MeshUpdate();
            Graphics.DrawMesh(curve.mesh, Vector3.zero, Quaternion.identity, MakeMesh.SelectedCurveMaterial, 0);
        }
    }