Package com.jme3.effect.influencers
Class DefaultParticleInfluencer
java.lang.Object
com.jme3.effect.influencers.DefaultParticleInfluencer
- All Implemented Interfaces:
ParticleInfluencer
,Savable
,JmeCloneable
,Cloneable
- Direct Known Subclasses:
NewtonianParticleInfluencer
,RadialParticleInfluencer
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyVelocityVariation
(Particle particle) This method applies the variation to the particle with already set velocity.clone()
This method clones the influencer instance.void
cloneFields
(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.This method returns the initial velocity.float
This method returns the velocity variation.void
influenceParticle
(Particle particle, EmitterShape emitterShape) This method influences the particle.jmeClone()
Called internally by com.jme3.util.clone.Cloner.void
read
(JmeImporter im) void
setInitialVelocity
(Vector3f initialVelocity) void
setVelocityVariation
(float variation) void
write
(JmeExporter ex)
-
Field Details
-
SAVABLE_VERSION
public static final int SAVABLE_VERSION- See Also:
-
temp
Temporary variable used to help with calculations. -
initialVelocity
The initial velocity of the particles. -
velocityVariation
protected float velocityVariationThe velocity's variation of the particles.
-
-
Constructor Details
-
DefaultParticleInfluencer
public DefaultParticleInfluencer()
-
-
Method Details
-
influenceParticle
Description copied from interface:ParticleInfluencer
This method influences the particle.- Specified by:
influenceParticle
in interfaceParticleInfluencer
- Parameters:
particle
- particle to be influencedemitterShape
- the shape of its emitter
-
applyVelocityVariation
This method applies the variation to the particle with already set velocity.- Parameters:
particle
- the particle to be affected
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
clone
Description copied from interface:ParticleInfluencer
This method clones the influencer instance.- Specified by:
clone
in interfaceParticleInfluencer
- Overrides:
clone
in classObject
- Returns:
- cloned instance
-
jmeClone
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new instance
-
cloneFields
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
cloneFields
in interfaceJmeCloneable
- Parameters:
cloner
- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.original
- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
-
setInitialVelocity
- Specified by:
setInitialVelocity
in interfaceParticleInfluencer
- 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 inParticleEmitter.setVelocityVariation(float)
. The particle will move with this velocity unless it is affected by gravity.
-
getInitialVelocity
Description copied from interface:ParticleInfluencer
This method returns the initial velocity.- Specified by:
getInitialVelocity
in interfaceParticleInfluencer
- Returns:
- the initial velocity
-
setVelocityVariation
public void setVelocityVariation(float variation) - Specified by:
setVelocityVariation
in interfaceParticleInfluencer
- 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 inParticleEmitter.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 interfaceParticleInfluencer
- Returns:
- the velocity variation
-