com.jme3.effect.influencers
Class DefaultParticleInfluencer

java.lang.Object
  extended by com.jme3.effect.influencers.DefaultParticleInfluencer
All Implemented Interfaces:
ParticleInfluencer, Savable, java.lang.Cloneable
Direct Known Subclasses:
NewtonianParticleInfluencer

public class DefaultParticleInfluencer
extends java.lang.Object
implements ParticleInfluencer

This emitter influences the particles so that they move all in the same direction. The direction may vary a little if the velocity variation is non zero. This influencer is default for the particle emitter.


Field Summary
protected  Vector3f startVelocity
          The initial velocity of the particles.
protected  Vector3f temp
          Temporary variable used to help with calculations.
protected  float velocityVariation
          The velocity's variation of the particles.
 
Constructor Summary
DefaultParticleInfluencer()
           
 
Method Summary
protected  void applyVelocityVariation(Particle particle)
          This method applies the variation to the particle with already set velocity.
 ParticleInfluencer clone()
          This method clones the influencer instance.
 Vector3f getInitialVelocity()
          This method returns the initial velocity.
 float getVelocityVariation()
          This method returns the velocity variation.
 void influenceParticle(Particle particle, EmitterShape emitterShape)
          This method influences the particle.
 void read(JmeImporter im)
           
 void setInitialVelocity(Vector3f initialVelocity)
           
 void setVelocityVariation(float variation)
           
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

temp

protected transient Vector3f temp
Temporary variable used to help with calculations.


startVelocity

protected Vector3f startVelocity
The initial velocity of the particles.


velocityVariation

protected float velocityVariation
The velocity's variation of the particles.

Constructor Detail

DefaultParticleInfluencer

public DefaultParticleInfluencer()
Method Detail

influenceParticle

public void influenceParticle(Particle particle,
                              EmitterShape emitterShape)
Description copied from interface: ParticleInfluencer
This method influences the particle.

Specified by:
influenceParticle in interface ParticleInfluencer
Parameters:
particle - particle to be influenced
emitterShape - the shape of it emitter

applyVelocityVariation

protected void applyVelocityVariation(Particle particle)
This method applies the variation to the particle with already set velocity.

Parameters:
particle - the particle to be affected

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

clone

public ParticleInfluencer clone()
Description copied from interface: ParticleInfluencer
This method clones the influencer instance.

Specified by:
clone in interface ParticleInfluencer
Overrides:
clone in class java.lang.Object
Returns:
cloned instance

setInitialVelocity

public void setInitialVelocity(Vector3f initialVelocity)
Specified by:
setInitialVelocity in interface ParticleInfluencer
Parameters:
initialVelocity - Set the initial velocity a particle is spawned with, the initial velocity given in the parameter will be varied according to the velocity variation set in ParticleEmitter.setVelocityVariation(float). A particle will move toward its velocity unless it is effected by the gravity.

getInitialVelocity

public Vector3f getInitialVelocity()
Description copied from interface: ParticleInfluencer
This method returns the initial velocity.

Specified by:
getInitialVelocity in interface ParticleInfluencer
Returns:
the initial velocity

setVelocityVariation

public void setVelocityVariation(float variation)
Specified by:
setVelocityVariation in interface ParticleInfluencer
Parameters:
variation - Set the variation by which the initial velocity of the particle is determined. variation should be a value from 0 to 1, where 0 means particles are to spawn with exactly the velocity given in ParticleEmitter.setInitialVelocity(com.jme3.math.Vector3f), and 1 means particles are to spawn with a completely random velocity.

getVelocityVariation

public float getVelocityVariation()
Description copied from interface: ParticleInfluencer
This method returns the velocity variation.

Specified by:
getVelocityVariation in interface ParticleInfluencer
Returns:
the velocity variation