[SOLVED] Explosion not visibly exploding

When the enemy node is detected as have been removed from the main enemy node (like after being shot), I remove the enemy from the main enemy node and trigger an explosion (using the palette explosion code). When the explosion has 0 particles, I finally remove the enemy instance from an enemy List.

I’ve tested the code using println(), and everything seems to be functioning correctly (the ParticleEmitter even registered as having particles), except there are no visible particles.

I know that my ParticleEmitter is attached to the rootNode through a few other nodes (main enemy node and environment node).

protected void explode(AssetManager assetManager) {
	debrisEffect = new ParticleEmitter("Debris", ParticleMesh.Type.Triangle, 10);
	Material debrisMat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
	debrisMat.setTexture("Texture", assetManager.loadTexture("Textures/Effects/fiery.png"));
	debrisEffect.setImagesX(3); debrisEffect.setImagesY(3); // 3x3 texture animation
	debrisEffect.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 4, 0));
	debrisEffect.setStartColor(new ColorRGBA(1f, 1f, 1f, 1f));
	exploId = id+" explosion";
	exploded = true;

How do you know that?

The included code doesn’t show. It only shows a magic “explodeNode”… which for all we know could be attached to the removed enemy node.

This is in the Enemy class. It handles explosion triggering and cleanup.

protected boolean isReal(Node enemyNode) {
	// detects removal from Node badguys
	return enemyNode.getChild(id) != null;
protected void doExplosion(AssetManager manager, Node enemyNode) {
	if (!isReal(enemyNode) && !exploded) {
protected void cleanExplosion(Node enemyNode) {
	//if (exploded) System.out.println(debrisEffect.getParticles().length);
	if (exploded && debrisEffect.getParticles().length == 0) {
		remove = true;

This code is in the simpleUpdate method.

ArrayList<Badguy> removables = new ArrayList<>();
for (Badguy i : enemyList) {
	i.doExplosion(assetManager, enemyNode);
	if (i.purge()) removables.add(i);
if (!removables.isEmpty()) for (Badguy i : removables) {

EnemyNode is directly attached to the rootNode, and is never removed from it. The magical exploNode is attached to enemyNode (which is constant). And yes, I know for a fact that exploNode is attached to enemyNode.

Edit: Sorry, when I said “Enemy class” I meant “Badguy class”

Maybe try posting this code that is only relevent to the ParticleEmitter into a quick new BasicGame template with the blue cube, and see if it renders properly there.

At first glance, your code for the particle emitter looks correct. The only thing to make sure of is that your custom texture named “fiery” is indeed a 3x3 texture atlas.

Edit: I also notice you aren’t setting a startSize or an endSize. I’m not sure if you scale up your particleEmitter elsewhere by scaling the parent node - but i think it could also be possible that your particle emitters are too small to be noticed depending on the scale of the rest of your world, since its all relative.

Or as Paul mentioned, it could be a node attachment issue.

I fixed it. I wasn’t translating my explosion to the correct place. :roll_eyes:

1 Like