public void CreateExplosionVertices(float time) { int particles = 2; explosionVertices = new VertexExplosion[particles * 6]; int i = 0; for (int partnr = 0; partnr < particles; partnr++) { Vector3 startingPos = new Vector3(5, 0, 0); float r1 = (float)rand.NextDouble() - 0.5f; float r2 = (float)rand.NextDouble() - 0.5f; float r3 = (float)rand.NextDouble() - 0.5f; Vector3 moveDirection = new Vector3(r1, r2, r3); moveDirection.Normalize(); float r4 = (float)rand.NextDouble(); r4 = r4 / 4.0f * 3.0f + 0.25f; temp += 0.3f; Matrix test = Matrix.Identity*Matrix.CreateRotationZ(temp); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 0, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4)); } }
public void CreateExplosionVertices(float time) { int particles = 2; explosionVertices = new VertexExplosion[particles * 6]; int i = 0; for (int partnr = 0; partnr < particles; partnr++) { Vector3 startingPos = new Vector3(5, 0, 0); float r1 = (float)rand.NextDouble() - 0.5f; float r2 = (float)rand.NextDouble() - 0.5f; float r3 = (float)rand.NextDouble() - 0.5f; Vector3 moveDirection = new Vector3(r1, r2, r3); moveDirection.Normalize(); float r4 = (float)rand.NextDouble(); r4 = r4 / 4.0f * 3.0f + 0.25f; temp += 0.3f; Matrix test = Matrix.Identity * Matrix.CreateRotationZ(temp); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 0, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 1, time, 1000), new Vector4(moveDirection, r4)); explosionVertices[i++] = new VertexExplosion(startingPos, new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4)); } }