hi!
since i am using jme2 i have a problem when setting the repeattype to RT_CLAMP on my particlecontroller: i see no particles.
if dont set the repeattype it works fine, except that i want the particles to be created once.
any ideas? with jme1 it worked. but in both versions it looks like a particle or something ist created at position (0,0,0).
public static Node createExplosion(ParticleMesh particleMesh, Node particleNode) {
BlendState blendState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
blendState.setBlendEnabled(true);
blendState.setSourceFunction(SourceFunction.SourceAlpha);
blendState.setDestinationFunction(DestinationFunction.One);
blendState.setTestEnabled(true);
blendState.setTestFunction(TestFunction.GreaterThan);
blendState.setEnabled(true);
particleNode.setRenderState(blendState);
TextureState textureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
textureState.setTexture(StarUtils.loadTexture("flaresmall.jpg"));
textureState.setEnabled(true);
particleNode.setRenderState(textureState);
particleMesh = ParticleFactory.buildParticles("particles", 100);
particleMesh.setEmissionDirection(new Vector3f(0, 1, 0));
particleMesh.setInitialVelocity(.025f);
particleMesh.setStartSize(1.2f);
particleMesh.setEndSize(.1f);
particleMesh.setMinimumLifeTime(100f);
particleMesh.setMaximumLifeTime(5000f);
particleMesh.setStartColor(ColorRGBA.orange);
particleMesh.setEndColor(ColorRGBA.black);
particleMesh.setMaximumAngle(360f * FastMath.DEG_TO_RAD);
particleMesh.setEmitType(EmitType.Point);
particleMesh.setReleaseRate(1000);
particleMesh.setSpeed(2f);
ParticleController particleController = particleMesh.getParticleController();
particleController.setControlFlow(true);
particleController.setRepeatType(ParticleController.RT_CLAMP);
ZBufferState zbufferState = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
zbufferState.setEnabled(false);
particleMesh.setRenderState(zbufferState);
particleMesh.setModelBound(new BoundingSphere());
particleMesh.updateModelBound();
particleNode.attachChild(particleMesh);
particleNode.setIsCollidable(false);
return particleNode;
}
calling it like this and adding it to the parentnode:
Node particleNode = new Node();
ParticleMesh particleMesh = new ParticleMesh();
createExplosion(particleMesh, particleNode);
particleNode.setLocalTranslation(getPosition());
particleNode.updateRenderState();
getParent().attachChild(particleNode);