APIdia Launch Partner
Top Inners Fields Constructors Methods
com.badlogic.gdx.physics.box2d.graphics

public Class ParticleEmitterBox2D

extends ParticleEmitter
Class Inheritance
Imports
java.io.BufferedReader, .IOException, com.badlogic.gdx.graphics.g2d.ParticleEmitter, .Sprite, com.badlogic.gdx.math.MathUtils, .Vector2, com.badlogic.gdx.physics.box2d.Fixture, .RayCastCallback, .World

Author
kalle_h ParticleEmitterBox2D use box2d rayCast:ing to achieve continuous collision detection against box2d fixtures. If particle detect collision it change it's direction before actual collision would occur. Velocity is 100% reflected. These particles does not have any other physical attributes or functionality. Particles can't collide to other particles.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ParticleEmitterBox2D.ParticleBox2D

Particle that can collide to box2d fixtures

Field Summary

Modifier and TypeField and Description
pack-priv final Vector2
private static final float
EPSILON

If velocities squared is shorter than this it could lead 0 length rayCast that cause c++ assertion at box2d

pack-priv float
pack-priv boolean
particleCollided

collision flag

pack-priv final RayCastCallback
rayCallBack

default visibility to prevent synthetic accessor creation

pack-priv final Vector2
pack-priv final World
Inherited from com.badlogic.gdx.graphics.g2d.ParticleEmitter:
durationdurationTimer

Constructor Summary

AccessConstructor and Description
public
ParticleEmitterBox2D(World world)

Constructs default ParticleEmitterBox2D.

public
ParticleEmitterBox2D(World world, BufferedReader reader)

/**Constructs ParticleEmitterBox2D using bufferedReader.

public
ParticleEmitterBox2D(World world, ParticleEmitter emitter)

Constructs ParticleEmitterBox2D fully copying given emitter attributes.

Method Summary

Modifier and TypeMethod and Description
protected ParticleEmitter.Particle
Inherited from com.badlogic.gdx.graphics.g2d.ParticleEmitter:
addParticleaddParticlesallowCompletioncleansUpBlendFunctiondrawdrawflipYgetActiveCountgetAllowCompletiongetAnglegetBoundingBoxgetDelaygetDurationgetEmissiongetGravitygetImagePathsgetLifegetLifeOffsetgetMaxParticleCountgetMinParticleCountgetMotionValuesgetNamegetParticlesgetPercentCompletegetRotationgetSpawnHeightgetSpawnShapegetSpawnWidthgetSpriteModegetSpritesgetTintgetTransparencygetVelocitygetWindgetXgetXOffsetValuegetXScalegetXSizeValuesgetYgetYOffsetValuegetYScalegetYSizeValuesisAdditiveisAlignedisAttachedisBehindisCompleteisContinuousisPremultipliedAlphaloadmatchMotionmatchSizematchXSizematchYSizepreAllocateParticlesresetresetsavescaleMotionscaleSizescaleSizesetAdditivesetAlignedsetAttachedsetBehindsetCleansUpBlendFunctionsetContinuoussetFlipsetImagePathssetMaxParticleCountsetMinParticleCountsetNamesetPositionsetPremultipliedAlphasetSpriteModesetSpritesstartupdate

Field Detail

endPointback to summary
pack-priv final Vector2 endPoint
EPSILONback to summary
private static final float EPSILON

If velocities squared is shorter than this it could lead 0 length rayCast that cause c++ assertion at box2d

normalAngleback to summary
pack-priv float normalAngle
particleCollidedback to summary
pack-priv boolean particleCollided

collision flag

rayCallBackback to summary
pack-priv final RayCastCallback rayCallBack

default visibility to prevent synthetic accessor creation

startPointback to summary
pack-priv final Vector2 startPoint
worldback to summary
pack-priv final World world

Constructor Detail

ParticleEmitterBox2Dback to summary
public ParticleEmitterBox2D(World world)

Constructs default ParticleEmitterBox2D. Box2d World is used for rayCasting. Assumes that particles use same unit system that box2d world does.

ParticleEmitterBox2Dback to summary
public ParticleEmitterBox2D(World world, BufferedReader reader) throws IOException

/**Constructs ParticleEmitterBox2D using bufferedReader. Box2d World is used for rayCasting. Assumes that particles use same unit system that box2d world does.

ParticleEmitterBox2Dback to summary
public ParticleEmitterBox2D(World world, ParticleEmitter emitter)

Constructs ParticleEmitterBox2D fully copying given emitter attributes. Box2d World is used for rayCasting. Assumes that particles use same unit system that box2d world does.

Method Detail

newParticleback to summary
protected ParticleEmitter.Particle newParticle(Sprite sprite)

Overrides com.badlogic.gdx.graphics.g2d.ParticleEmitter.newParticle.

Annotations
@Override
com.badlogic.gdx.physics.box2d.graphics back to summary

private Class ParticleEmitterBox2D.ParticleBox2D

extends Particle
Class Inheritance

Particle that can collide to box2d fixtures

Field Summary

Inherited from com.badlogic.gdx.graphics.g2d.ParticleEmitter.Particle:
angleangleCosangleDiffangleSincurrentLifeframegravitygravityDiffliferotationrotationDifftinttransparencytransparencyDiffvelocityvelocityDiffwindwindDiffxScalexScaleDiffyScaleyScaleDiff

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
translate(float velocityX, float velocityY)

Overrides com.badlogic.gdx.graphics.g2d.Sprite.translate.

translate particle given amount.

Constructor Detail

ParticleBox2Dback to summary
public ParticleBox2D(Sprite sprite)

Method Detail

translateback to summary
public void translate(float velocityX, float velocityY)

Overrides com.badlogic.gdx.graphics.g2d.Sprite.translate.

translate particle given amount. Continuous collision detection achieved by using RayCast from oldPos to newPos.

Annotations
@Override