// Use this for initialization public ParticleModel(ClothSimulation settings) { // Create particles int RES = settings.particles; this.particlesSize = RES; SIZE = settings.totalSize; float D = SIZE / RES; // dx, dy, dz = total size devided by resolution float zCoord = 1; this.Res = RES; initPoints(D, D, RES, RES, zCoord); Debug.Log(positions.Length + " particles created"); // Create constraints on particles initConstraints( ); // Initialize simulation calculation velocities = new Vector3[positions.Length]; forces = new Vector3[positions.Length]; if (settings.parrallel) { pmc = new ParrallelPMCalculator(this); } else { pmc = new SimplePMCalculator(this); } pmc.Iterations = settings.iterations; }
public void SetPMC(PMCalculator pmc) { this.pmc.Release( ); this.pmc = pmc; }