[solved] Problem with particles

Ive run into a problem with the particles in JME.



Everything works fine up until the point where the FPS drops below 90. At this point the explosions start generating at 0,0,0 instead of at the position vector i pass to them ( ive checked the vector and it prints the correct values out )



Everything is fine.







FPS goes below 90 and the position is broken.



public class Bullet extends Node {
   private Vector3f position = new Vector3f();
   private float angle=0;
   private float velocity=0;
   boolean alive = true;
   float distance = 0;
   float explodeDist = 60f;
   Vector3f origPos = new Vector3f();
   public Bullet(){
      attachChild(ModelLoader.getModel3ds(new File("res/bullet.3ds")));
      setLocalScale(0.4f);
   }
   public void update(float tpf){
      distance = getLocalTranslation().distance(origPos);
      
      velocity = (tpf*60)*0.9f;
      
        position.addLocal(getLocalRotation().getRotationColumn(2)
                .multLocal(velocity));
       
        setLocalTranslation(position);
       
        if(distance >= explodeDist){
           alive=false;
           ExplosionFactory.getInstance().createExplosion(position);
           //AudioFactory.getInstance().playSound();
        }
   }
   public void fire(Vector3f origin, float nangle){
      origPos.set(origin);
      angle = nangle;
      position.set(origin);
      position.setY(3f);
      setLocalRotation(new Quaternion().fromAngleAxis((
              FastMath.PI * angle)/180, new Vector3f(0,1,0)));
      //position.addLocal(getLocalRotation().getRotationColumn(2)
               // .multLocal(4f));
   }
   public Vector3f getPosition(){
      return position;
   }
   public boolean isAlive(){
      return alive;
   }
   
}



public class ExplosionFactory extends Node {
   private ArrayList<Node> explosions = new ArrayList<Node>();
   private static ExplosionFactory instance;
   public ExplosionFactory(){
      instance = this;
   }
   public Node loadExplosion(){
      Node pMesh=null;
      try{
      
         pMesh = (Node) BinaryImporter.getInstance().load(
            new File("res/explosion.jme"));
         
      }catch(IOException e){}
      pMesh.setLocalScale(0.03f);
      return pMesh;
   }
   public static ExplosionFactory getInstance(){
      return instance;
   }
   public void createExplosion(Vector3f pos){
      Node pMesh = loadExplosion();
      explosions.add(pMesh);
      this.attachChild(pMesh);
      pMesh.updateRenderState();
      explode(pos,pMesh);
   }
   public void explode(Vector3f pos, Node pMesh){
      System.out.println(pos.toString());
       pMesh.setLocalTranslation(pos);
       pMesh.getLocalTranslation().setY(1f);
       
       ArrayList children = pMesh.getChildren();
       for(int n = 0; n<children.size();n++){
          ParticleMesh p = (ParticleMesh)pMesh.getChild(n);
          p.setLocalTranslation(pos);
           p.getLocalTranslation().setY(1f);
          p.forceRespawn();
       }
   }
   public void update(){
      for(int x = 0; x<explosions.size();x++){
         Node parent = explosions.get(x);
         ParticleMesh n = (ParticleMesh)explosions.get(x).getChild(4);
         
         if(!n.isActive()){
            explosions.remove(parent);
            detachChild(parent);
         }
      }
   }
}

I don't see you calling updateGeometricState anywhere after creating the explosion; this is necessary for the world vectors to be updated so they reflect the current transformation state.

Thanks. I had the same problem with setLocalTranslation and that really helped me out