示例#1
0
    void CreateTracers()
    {
        Vector3 numCells             = new Vector3(grid.GetNumCells(0), grid.GetNumCells(1), grid.GetNumCells(2));
        Vector3 relativeCenterOfGrid = new Vector3(grid.GetCellExtent().x / 2, grid.GetCellExtent().y / 2, grid.GetCellExtent().z / 2);

        for (uint i = 0; i < numCells.x; ++i)
        {
            for (uint j = 0; j < numCells.y; ++j)
            {
                for (uint k = 0; k < numCells.z; ++k)
                {
                    ParticleSystem.Particle newTracer = new ParticleSystem.Particle();
                    uint[] indices = { i, j, k };
                    newTracer.position   = (grid.PositionFromIndices(indices) + relativeCenterOfGrid);
                    newTracer.startColor = new Color32(255, 255, 255, 50);
                    newTracer.startSize  = 0.2f;
                    newTracer.lifetime   = 9999;
                    tracers.Add(newTracer);
                }
            }
        }
    }