Particle in jME3

Hey guys.

Recently started tryna setup my particles for my game. I made a class which extends particleemitter - so I can try and make some snow particle effects.

I instantiate my snow object and attachChild to the rootNode.

This works fine - however if i make a call in my simpleUpdate() method to rootNode.updateGeographicState it null pointers with error :

   at com.jme3.scene.Geometry.updateWorldBound(
   at com.jme3.scene.Spatial.updateGeometricState(
   at com.jme3.bullet.nodes.PhysicsNode.updateGeometricState(
   at com.jme3.scene.Node.updateGeometricState(
   at org.snow.main.Main.simpleUpdate(
   at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
   at Source)

Is this a bug? If this is desired result of doing what I did - how do I avoid that? What does updateGeographicState even do? I just do it each frame for best practice.



You shouldn't call updateGeometricState() in most cases.

Calling it per-frame on the rootNode is not necessary; it's already done in the SimpleApplication class for you.

It probably crashes because the ParticleMesh was not initialized, since updateLogicalState() should have been called first. Either way, simply removing all your invocations to updateGeometricState() should fix the issue.

Which it does ty.

Ok so i have created a weather effect - using particles, but am not entirly sure how to make it appear across my entire scene.

I have attached the effect to a box node - but how do i make it across the 'world' I have done set gravity to 1, so it will fall like weather.

Do I attach the effect to the skymap? How do I make the particleemitter create enough to fill the screen? The effect im making is snow and this is what I have so far:

package org.snow.particles;

import com.jme3.asset.AssetManager;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;

public class SnowParticle extends ParticleEmitter{

   AssetManager assetManager;
   public SnowParticle(AssetManager assetManager){
      super("Emitter", ParticleMesh.Type.Triangle, 30);
      this.assetManager = assetManager;

   private void setupMaterial() {
      // TODO Auto-generated method stub
       Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
          mat_red.setTexture("m_Texture", assetManager.loadTexture("Effects/Explosion/spark.png"));
          this.setImagesY(1); // 2x2 texture animation
          this.setEndColor(  new ColorRGBA(0.92f, 0.92f, 0.92f, 0.6f));   // red
          this.setStartColor(new ColorRGBA(1f, 1f, 1f, 0f)); // yellow
          this.setStartVel(new Vector3f(0, 2, 0));

Well, don't let it snow everywhere, but only near the player, normally noone will realize this if tweaked correctly.

Right, yes thats fine - but how do i do that then!?

set location / set emmiter location or something like that was it named, look in the tespackage the moving smoke, kind alike that only with smaller gravity affected particles.

You can set the emitter "emission shape" to a box that is overhead the player, for example.

Ah i see - so i would hang it above the box which is my player

  • but it would still need to be a big box to make it look like its snowing in the distance - and up close?

Yes and now, in the far snow looks more like some kinda of white fog,

only for near you really need it, it is often enough to give the right effect.