コード例 #1
0
        protected virtual void Update()
        {
            simulator.Gravity(compute, gravity, Time.deltaTime);
            simulator.Step(compute, decay);
            for (int i = 0; i < iterations; i++)
            {
                simulator.Solve(compute);
            }

            if (drawNode)
            {
                RenderNodes();
            }
            if (drawEdge)
            {
                RenderEdges();
            }
        }
コード例 #2
0
        protected void Update()
        {
            var dt = Time.deltaTime;

            simulator.Step(verletCompute, decay);
            for (int i = 0; i < iterations; i++)
            {
                // simulator.Solve(verletCompute);
                Solve(); // optimized solver
            }
            simulator.Gravity(verletCompute, gravity, dt);
            Flow(dt);
            Relax(dt);
            Decay(dt);

            // if(Input.GetMouseButton(0))
            {
                Touch(Input.mousePosition);
            }

            Render();
        }