@Override public void simpleUpdate(float tpf) { angle += tpf; angle %= FastMath.TWO_PI; float x = FastMath.cos(angle) * 2; float y = FastMath.sin(angle) * 2; emit.setLocalTranslation(x, 0, y); } }
public void collision(PhysicsCollisionEvent event) { if (event.getObjectA() instanceof BombControl) { final Spatial node = event.getNodeA(); effect.killAllParticles(); effect.setLocalTranslation(node.getLocalTranslation()); effect.emitAllParticles(); } else if (event.getObjectB() instanceof BombControl) { final Spatial node = event.getNodeB(); effect.killAllParticles(); effect.setLocalTranslation(node.getLocalTranslation()); effect.emitAllParticles(); } }
public void collision(PhysicsCollisionEvent event) { if (space == null) { return; } if (event.getObjectA() == this || event.getObjectB() == this) { space.add(ghostObject); ghostObject.setPhysicsLocation(getPhysicsLocation(vector)); space.addTickListener(this); if (effect != null && spatial.getParent() != null) { curTime = 0; effect.setLocalTranslation(spatial.getLocalTranslation()); spatial.getParent().attachChild(effect); effect.emitAllParticles(); } space.remove(this); spatial.removeFromParent(); } }
fire.setLowLife(0.5f); fire.setHighLife(3f); fire.setLocalTranslation(0, 0.2f, 0); smoke.setLowLife(100f); smoke.setHighLife(100f); smoke.setLocalTranslation(0, 0.1f, 0); smoke.emitAllParticles();
private void createFire() { /** * Uses Texture from jme3-test-data library! */ ParticleEmitter fire = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30); Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat_red.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); fire.setMaterial(mat_red); fire.setImagesX(2); fire.setImagesY(2); // 2x2 texture animation fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0)); fire.setStartSize(10f); fire.setEndSize(1f); fire.setGravity(0, 0, 0); fire.setLowLife(0.5f); fire.setHighLife(1.5f); fire.getParticleInfluencer().setVelocityVariation(0.3f); fire.setLocalTranslation(-600, 50, 300); fire.setQueueBucket(Bucket.Translucent); rootNode.attachChild(fire); }
fire.setHighLife(1.5f); fire.getParticleInfluencer().setVelocityVariation(0.3f); fire.setLocalTranslation(5.0f, 0, 1.0f); fire.setLocalScale(0.3f); fire.setQueueBucket(Bucket.Translucent);
public void collision(PhysicsCollisionEvent event) { if (space == null) { return; } if (event.getObjectA() == this || event.getObjectB() == this) { space.add(ghostObject); ghostObject.setPhysicsLocation(getPhysicsLocation(vector)); space.addTickListener(this); if (effect != null && spatial.getParent() != null) { curTime = 0; effect.setLocalTranslation(spatial.getLocalTranslation()); spatial.getParent().attachChild(effect); effect.emitAllParticles(); } space.remove(this); spatial.removeFromParent(); } }