@Override public void onRun() { Location location = getLocation(); for (int j = 0; j < stepsPerIteration; j++) { if (step % particles == 0) { rndF.clear(); rndAngle.clear(); } while (rndF.size() < arcs) { rndF.add(RandomUtils.random.nextFloat()); } while (rndAngle.size() < arcs) { rndAngle.add(RandomUtils.getRandomAngle()); } for (int i = 0; i < arcs; i++) { float pitch = rndF.get(i) * 2 * this.pitch - this.pitch; float x = (step % particles) * length / particles; float y = (float) (pitch * Math.pow(x, 2)); Vector v = new Vector(x, y, 0); VectorUtils.rotateAroundAxisX(v, rndAngle.get(i)); VectorUtils.rotateAroundAxisZ(v, -location.getPitch() * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -(location.getYaw() + 90) * MathUtils.degreesToRadians); display(particle, location.add(v)); location.subtract(v); } step++; } } }
double r1 = RandomUtils.getRandomAngle(), r2 = RandomUtils.getRandomAngle(), r3 = RandomUtils.getRandomAngle(); for (Vector v : cache) { if (v.getY() > 0) {
@Override public void onRun() { Location location = getLocation(); for (int x = 0; x < particles; x++) { if (step > particlesCone) { step = 0; } if (randomize && step == 0) { rotation = RandomUtils.getRandomAngle(); } double angle = step * angularVelocity + rotation; float radius = step * radiusGrow; float length = step * lengthGrow; Vector v = new Vector(Math.cos(angle) * radius, length, Math.sin(angle) * radius); VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians); location.add(v); display(particle, location); location.subtract(v); step++; } } }