private static void CreateFluidBlob(Scene scene) { // The number of particles we want along one of the three dimensions const int d = 15; // Create the particle fluid var particleFluid = scene.Physics.CreateParticleFluid(d * d * d); particleFluid.RestParticleDistance *= 10.5f; // // Create an array to hold the positions of the particles var particlePositions = new Vector3[particleFluid.MaximumParticles]; var blobOffset = -new Vector3(d) * 0.5f; int i = 0; for (int x = 0; x < d; x++) { for (int y = 0; y < d; y++) { for (int z = 0; z < d; z++) { // Compute the location in a grid of particles + move the grid back so its center is at 0, 0, 0 particlePositions[i++] = new Vector3(x, 20 + y, z) + blobOffset; } } } // Add the particles var particleCreateDesc = new ParticleCreationData() { NumberOfParticles = particleFluid.MaximumParticles, PositionBuffer = particlePositions, IndexBuffer = Enumerable.Range(0, particlePositions.Length).ToArray() }; int numCreated = particleFluid.CreateParticles(particleCreateDesc); scene.AddActor(particleFluid); }