Codota Logo
ParticleEmitter.setParticlesPerSec
Code IndexAdd Codota to your IDE (free)

How to use
setParticlesPerSec
method
in
com.jme3.effect.ParticleEmitter

Best Java code snippets using com.jme3.effect.ParticleEmitter.setParticlesPerSec (Showing top 20 results out of 315)

  • Common ways to obtain ParticleEmitter
private void myMethod () {
ParticleEmitter p =
  • Codota IconGeometry geometry;(ParticleEmitter) geometry.clone(cloneMaterial)
  • Codota IconInputCapsule inputCapsule;String str;(ParticleEmitter) inputCapsule.readSavable(str, null)
  • Smart code suggestions by Codota
}
origin: jMonkeyEngine/jmonkeyengine

private void stop() {
  emitter.setParticlesPerSec(0);
  emitted = false;
  if (!killParticles.stopRequested) {
    emitter.addControl(killParticles);
    killParticles.stopRequested = true;
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Creates and EffectTrack
 *
 * @param emitter the emitter of the track
 * @param length the length of the track (usually the length of the
 * animation you want to add the track to)
 */
public EffectTrack(ParticleEmitter emitter, float length) {
  this.emitter = emitter;
  //saving particles per second value
  this.particlesPerSeconds = emitter.getParticlesPerSec();
  //setting the emmitter to not emmit.
  this.emitter.setParticlesPerSec(0);
  this.length = length;
  //Marking the emitter with a reference to this track for further use in deserialization.
  setUserData(this);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Internal use only serialization
 *
 * @param ex exporter
 * @throws IOException exception
 */
@Override
public void write(JmeExporter ex) throws IOException {
  OutputCapsule out = ex.getCapsule(this);
  //reset the particle emission rate on the emitter before saving.
  emitter.setParticlesPerSec(particlesPerSeconds);
  out.write(emitter, "emitter", null);
  out.write(particlesPerSeconds, "particlesPerSeconds", 0);
  out.write(length, "length", 0);
  out.write(startOffset, "startOffset", 0);
  //Setting emission rate to 0 so that this track can go on being used.
  emitter.setParticlesPerSec(0);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the Emitter to use in this track
 *
 * @param emitter
 */
public void setEmitter(ParticleEmitter emitter) {
  if (this.emitter != null) {
    TrackInfo data = (TrackInfo) emitter.getUserData("TrackInfo");
    data.getTracks().remove(this);
  }
  this.emitter = emitter;
  //saving particles per second value
  this.particlesPerSeconds = emitter.getParticlesPerSec();
  //setting the emmitter to not emmit.
  this.emitter.setParticlesPerSec(0);
  setUserData(this);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * This method clone the Track and search for the cloned counterpart of the
 * original emitter in the given cloned spatial. The spatial is assumed to
 * be the Spatial holding the AnimControl controlling the animation using
 * this Track.
 *
 * @param spatial the Spatial holding the AnimControl
 * @return the cloned Track with proper reference
 */
@Override
public Track cloneForSpatial(Spatial spatial) {
  EffectTrack effectTrack = new EffectTrack();
  effectTrack.particlesPerSeconds = this.particlesPerSeconds;
  effectTrack.length = this.length;
  effectTrack.startOffset = this.startOffset;
  //searching for the newly cloned ParticleEmitter
  effectTrack.emitter = findEmitter(spatial);
  if (effectTrack.emitter == null) {
    logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{emitter.getName(), spatial.getName()});
    effectTrack.emitter = emitter;
  }
  removeUserData(this);
  //setting user data on the new emmitter and marking it with a reference to the cloned Track.
  setUserData(effectTrack);
  effectTrack.emitter.setParticlesPerSec(0);
  return effectTrack;
}
origin: jMonkeyEngine/jmonkeyengine

  /**
   * Internal use only serialization
   *
   * @param im importer
   * @throws IOException Exception
   */
  @Override
  public void read(JmeImporter im) throws IOException {
    InputCapsule in = im.getCapsule(this);
    this.particlesPerSeconds = in.readFloat("particlesPerSeconds", 0);
    //reading the emitter even if the track will then reference its cloned counterpart if it's loaded with the assetManager.
    //This also avoid null pointer exception if the model is not loaded via the AssetManager.
    emitter = (ParticleEmitter) in.readSavable("emitter", null);
    emitter.setParticlesPerSec(0);
    //if the emitter was saved with a KillParticleControl we remove it.
//        Control c = emitter.getControl(KillParticleControl.class);
//        if(c!=null){
//            emitter.removeControl(c);
//        }
    //emitter.removeControl(KillParticleControl.class);
    length = in.readFloat("length", length);
    startOffset = in.readFloat("startOffset", 0);
  }
}
origin: jMonkeyEngine/jmonkeyengine

emitter.setParticlesPerSec(particlesPerSeconds);
origin: jMonkeyEngine/jmonkeyengine

private void createSpark(){
  spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
  spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
  spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
  spark.setStartSize(.5f);
  spark.setEndSize(.5f);
  spark.setFacingVelocity(true);
  spark.setParticlesPerSec(0);
  spark.setGravity(0, 5, 0);
  spark.setLowLife(1.1f);
  spark.setHighLife(1.5f);
  spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0));
  spark.getParticleInfluencer().setVelocityVariation(1);
  spark.setImagesX(1);
  spark.setImagesY(1);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
  mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/spark.png"));
  spark.setMaterial(mat);
  explosionEffect.attachChild(spark);
}
origin: jMonkeyEngine/jmonkeyengine

  private void createSmokeTrail(){
    smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
    smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
    smoketrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
    smoketrail.setStartSize(.2f);
    smoketrail.setEndSize(1f);

//        smoketrail.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
    smoketrail.setFacingVelocity(true);
    smoketrail.setParticlesPerSec(0);
    smoketrail.setGravity(0, 1, 0);
    smoketrail.setLowLife(.4f);
    smoketrail.setHighLife(.5f);
    smoketrail.getParticleInfluencer()
        .setInitialVelocity(new Vector3f(0, 12, 0));
    smoketrail.getParticleInfluencer().setVelocityVariation(1);
    smoketrail.setImagesX(1);
    smoketrail.setImagesY(3);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/smoketrail.png"));
    smoketrail.setMaterial(mat);
    explosionEffect.attachChild(smoketrail);
  }

origin: jMonkeyEngine/jmonkeyengine

  private void createShockwave(){
    shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR);
//        shockwave.setRandomAngle(true);
    shockwave.setFaceNormal(Vector3f.UNIT_Y);
    shockwave.setStartColor(new ColorRGBA(.48f, 0.17f, 0.01f, (float) (.8f / COUNT_FACTOR_F)));
    shockwave.setEndColor(new ColorRGBA(.48f, 0.17f, 0.01f, 0f));

    shockwave.setStartSize(0f);
    shockwave.setEndSize(7f);

    shockwave.setParticlesPerSec(0);
    shockwave.setGravity(0, 0, 0);
    shockwave.setLowLife(0.5f);
    shockwave.setHighLife(0.5f);
    shockwave.getParticleInfluencer()
        .setInitialVelocity(new Vector3f(0, 0, 0));
    shockwave.getParticleInfluencer().setVelocityVariation(0f);
    shockwave.setImagesX(1);
    shockwave.setImagesY(1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/shockwave.png"));
    shockwave.setMaterial(mat);
    explosionEffect.attachChild(shockwave);
  }

origin: jMonkeyEngine/jmonkeyengine

private void prepareEffect(AssetManager assetManager) {
  int COUNT_FACTOR = 1;
  float COUNT_FACTOR_F = 1f;
  effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR);
  effect.setSelectRandomImage(true);
  effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F)));
  effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
  effect.setStartSize(1.3f);
  effect.setEndSize(2f);
  effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
  effect.setParticlesPerSec(0);
  effect.setGravity(0, -5f, 0);
  effect.setLowLife(.4f);
  effect.setHighLife(.5f);
  effect.getParticleInfluencer()
      .setInitialVelocity(new Vector3f(0, 7, 0));
  effect.getParticleInfluencer().setVelocityVariation(1f);
  effect.setImagesX(2);
  effect.setImagesY(2);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
  mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
  effect.setMaterial(mat);
}
origin: jMonkeyEngine/jmonkeyengine

private void createRoundSpark(){
  roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR);
  roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F)));
  roundspark.setEndColor(new ColorRGBA(0, 0, 0, (float) (0.5f / COUNT_FACTOR_F)));
  roundspark.setStartSize(1.2f);
  roundspark.setEndSize(1.8f);
  roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f));
  roundspark.setParticlesPerSec(0);
  roundspark.setGravity(0, -.5f, 0);
  roundspark.setLowLife(1.8f);
  roundspark.setHighLife(2f);
  roundspark.getParticleInfluencer()
      .setInitialVelocity(new Vector3f(0, 3, 0));
  roundspark.getParticleInfluencer().setVelocityVariation(.5f);
  roundspark.setImagesX(1);
  roundspark.setImagesY(1);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
  mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/roundspark.png"));
  mat.setBoolean("PointSprite", POINT_SPRITE);
  roundspark.setMaterial(mat);
  explosionEffect.attachChild(roundspark);
}
origin: jMonkeyEngine/jmonkeyengine

  private void prepareEffect() {
    int COUNT_FACTOR = 1;
    float COUNT_FACTOR_F = 1f;
    effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR);
    effect.setSelectRandomImage(true);
    effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F)));
    effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
    effect.setStartSize(1.3f);
    effect.setEndSize(2f);
    effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
    effect.setParticlesPerSec(0);
    effect.setGravity(0, -5, 0);
    effect.setLowLife(.4f);
    effect.setHighLife(.5f);
    effect.getParticleInfluencer()
        .setInitialVelocity(new Vector3f(0, 7, 0));
    effect.getParticleInfluencer().setVelocityVariation(1f);
    effect.setImagesX(2);
    effect.setImagesY(2);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
    effect.setMaterial(mat);
//        effect.setLocalScale(100);
    rootNode.attachChild(effect);
  }
 
origin: jMonkeyEngine/jmonkeyengine

private void createFlame(){
  flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR);
  flame.setSelectRandomImage(true);
  flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F)));
  flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
  flame.setStartSize(1.3f);
  flame.setEndSize(2f);
  flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
  flame.setParticlesPerSec(0);
  flame.setGravity(0, -5, 0);
  flame.setLowLife(.4f);
  flame.setHighLife(.5f);
  flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0));
  flame.getParticleInfluencer().setVelocityVariation(1f);
  flame.setImagesX(2);
  flame.setImagesY(2);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
  mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
  mat.setBoolean("PointSprite", POINT_SPRITE);
  flame.setMaterial(mat);
  explosionEffect.attachChild(flame);
}
origin: jMonkeyEngine/jmonkeyengine

private void createFlash(){
  flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR);
  flash.setSelectRandomImage(true);
  flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1f / COUNT_FACTOR_F)));
  flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
  flash.setStartSize(.1f);
  flash.setEndSize(3.0f);
  flash.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
  flash.setParticlesPerSec(0);
  flash.setGravity(0, 0, 0);
  flash.setLowLife(.2f);
  flash.setHighLife(.2f);
  flash.getParticleInfluencer()
      .setInitialVelocity(new Vector3f(0, 5f, 0));
  flash.getParticleInfluencer().setVelocityVariation(1);
  flash.setImagesX(2);
  flash.setImagesY(2);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
  mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flash.png"));
  mat.setBoolean("PointSprite", POINT_SPRITE);
  flash.setMaterial(mat);
  explosionEffect.attachChild(flash);
}
origin: jMonkeyEngine/jmonkeyengine

  private void createDebris(){
    debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
    debris.setSelectRandomImage(true);
    debris.setRandomAngle(true);
    debris.setRotateSpeed(FastMath.TWO_PI * 4);
    debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, (float) (1.0f / COUNT_FACTOR_F)));
    debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
    debris.setStartSize(.2f);
    debris.setEndSize(.2f);

//        debris.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
    debris.setParticlesPerSec(0);
    debris.setGravity(0, 12f, 0);
    debris.setLowLife(1.4f);
    debris.setHighLife(1.5f);
    debris.getParticleInfluencer()
        .setInitialVelocity(new Vector3f(0, 15, 0));
    debris.getParticleInfluencer().setVelocityVariation(.60f);
    debris.setImagesX(3);
    debris.setImagesY(3);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/Debris.png"));
    debris.setMaterial(mat);
    explosionEffect.attachChild(debris);
  }

origin: info.projectkyoto/mms-engine

private void stop() {
  emitter.setParticlesPerSec(0);
  emitted = false;
  if (!killParticles.stopRequested) {
    emitter.addControl(killParticles);
    killParticles.stopRequested = true;
  }
}
origin: org.jmonkeyengine/jme3-core

private void stop() {
  emitter.setParticlesPerSec(0);
  emitted = false;
  if (!killParticles.stopRequested) {
    emitter.addControl(killParticles);
    killParticles.stopRequested = true;
  }
}
origin: org.jmonkeyengine/jme3-core

/**
 * Creates and EffectTrack
 *
 * @param emitter the emitter of the track
 * @param length the length of the track (usually the length of the
 * animation you want to add the track to)
 */
public EffectTrack(ParticleEmitter emitter, float length) {
  this.emitter = emitter;
  //saving particles per second value
  this.particlesPerSeconds = emitter.getParticlesPerSec();
  //setting the emmitter to not emmit.
  this.emitter.setParticlesPerSec(0);
  this.length = length;
  //Marking the emitter with a reference to this track for further use in deserialization.
  setUserData(this);
}
origin: info.projectkyoto/mms-engine

/**
 * Internal use only serialization
 *
 * @param ex exporter
 * @throws IOException exception
 */
public void write(JmeExporter ex) throws IOException {
  OutputCapsule out = ex.getCapsule(this);
  //reseting the particle emission rate on the emitter before saving.
  emitter.setParticlesPerSec(particlesPerSeconds);
  out.write(emitter, "emitter", null);
  out.write(particlesPerSeconds, "particlesPerSeconds", 0);
  out.write(length, "length", 0);
  out.write(startOffset, "startOffset", 0);
  //Setting emission rate to 0 so that this track can go on being used.
  emitter.setParticlesPerSec(0);
}
com.jme3.effectParticleEmittersetParticlesPerSec

Javadoc

Set the number of particles to spawn per second.

Popular methods of ParticleEmitter

  • emitAllParticles
    Instantly emits all the particles possible to be emitted. Any particles which are currently inactive
  • getName
  • setQueueBucket
  • getMaterial
  • <init>
  • clone
  • getNumVisibleParticles
    Returns the number of visible particles (spawned but not dead).
  • setEndColor
    Set the end color of the particles spawned.The particle color at any time is determined by blending
  • setEndSize
    Set the end size of the particles spawned.The particle size at any time is determined by blending th
  • setGravity
    This method sets the gravity vector.
  • setHighLife
    Set the high value of life.The particle's lifetime/expiration is determined by randomly selecting a
  • setLowLife
    Set the low value of life.The particle's lifetime/expiration is determined by randomly selecting a t
  • setHighLife,
  • setLowLife,
  • setMaterial,
  • setNumParticles,
  • setShadowMode,
  • setStartColor,
  • setStartSize,
  • addControl,
  • emitParticle

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Path (java.nio.file)
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now