I’ve been toying a litle with this tutorial for the last days, and today i tried to add particles to the game.
I tried to point particles to the ground under my vehicle model and this is the result:
Positioning was not a problem, but as you see the particles appear all black and dont degrade to the given color. As soon as the transparent fence shows up on the screen the particles become almost transparent and random colored and the framerate drops to less than 5fps:
particles could be black due the lack of materialstate for the pointParticles or some problem with lighting, but i’ve tried adding a materialstate and alphastate to that spatial with the same results. Also tried to set renderqueuemode to opaque, but then the particles only show if no opaque element are is visible.
private void initParticles() {
dust = ParticleFactory.buildPointParticles("dust particles", 300);
dust.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT); // they will be translucent
dust.setReleaseRate(0); // will be used to enable/disable the particle generation
dust.setAntialiased(true);
dust.setMaximumAngle(FastMath.HALF_PI);
dust.setMinimumAngle(FastMath.HALF_PI);
dust.setMinimumLifeTime(500);
dust.setMaximumLifeTime(1500);
dust.setControlFlow(false);
dust.setInitialVelocity(0.0005f);
dust.setPointSize(10);
dust.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 1));
dust.setEndColor(new ColorRGBA(0.5f, 0.2f, 0.05f, 0));
dust.warmUp(150);
dust.setModelBound(new BoundingSphere());
dust.updateModelBound();
root.attachChild(dust);
}
and this enables the particle emission
private void setParticles(Vector3f location, Vector3f direction) {
dust.setOriginOffset(location);
dust.setEmissionDirection(direction.normalize());
dust.setReleaseRate(300);
}
thanks :D