/** * Add a particle to the grid structure. * \param hash cell hash, can be computed from the cellIndex (next parameter) using ComputeCellHash. * \param cellIndex 3-dimensional index of the cell to add the particle to. * \param p the particle that should be added to the grid. */ public void AddParticle(int hash, Vector3 cellIndex, ObiClothParticle p) { //See if the cell exists and insert the particle in it: Cell cell = null; if (cells.TryGetValue(hash,out cell)){ cell.AddParticle(p); }else{ cell = new Cell(this,cellIndex,hash); cell.AddParticle(p); cells[hash] = cell; } }