Package net.dermetfan.gdx.physics.box2d
Class Breakable
java.lang.Object
net.dermetfan.gdx.physics.box2d.Breakable
public class Breakable
extends java.lang.Object
Breaks bodies or fixtures if they get hit too hard. Put in fixture's or body's user data and set 
Don't forget to call
You can manually destroy fixtures or bodies using the
Breakable.Manager as ContactListener.Don't forget to call
Breakable.Manager.destroy() after every world time step.You can manually destroy fixtures or bodies using the
Breakable.Manager.destroy(Fixture) and Breakable.Manager.destroy(Body) methods.- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBreakable.Callbacka callback for aBreakableif its container (body or fixture) was destroyed (for example to play a sound)static classBreakable.ManagerManages theBreakablesof the Contacts it receives. - 
Constructor Summary
Constructors Constructor Description Breakable(float normalResistance, float tangentResistance)Breakable(float normalResistance, float tangentResistance, boolean breakBody)Breakable(float normalResistance, float tangentResistance, boolean breakBody, boolean breakBodyWithoutFixtures)Breakable(float normalResistance, float tangentResistance, boolean breakBody, Breakable.Callback callback)Breakable(float normalResistance, float tangentResistance, com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, boolean breakBodyWithoutFixtures, Breakable.Callback callback)Breakable(float normalResistance, float tangentResistance, Breakable.Callback callback)Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance)Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody)Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, boolean breakBodyWithoutFixtures)Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, Breakable.Callback callback)Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, Breakable.Callback callback)Breakable(Breakable other)constructs a new Breakable exactly like the given other one - 
Method Summary
Modifier and Type Method Description Breakable.CallbackgetCallback()floatgetNormalResistance()floatgetReactionForceLength2Resistance()com.badlogic.gdx.math.Vector2getReactionForceResistance()floatgetReactionTorqueResistance()floatgetTangentResistance()booleanisBreakBody()booleanisBreakBodyWithoutFixtures()voidsetBreakBody(boolean breakBody)voidsetBreakBodyWithoutFixtures(boolean breakBodyWithoutFixtures)voidsetCallback(Breakable.Callback callback)voidsetNormalResistance(float normalResistance)voidsetReactionForceLength2Resistance(float reactionForceLength2Resistance)voidsetReactionForceResistance(com.badlogic.gdx.math.Vector2 reactionForceResistance)voidsetReactionTorqueResistance(float reactionTorqueResistance)voidsetTangentResistance(float tangentResistance)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Constructor Details
- 
Breakable
public Breakable(float normalResistance, float tangentResistance)- See Also:
 Breakable(float, float, boolean)
 - 
Breakable
public Breakable(float normalResistance, float tangentResistance, boolean breakBody) - 
Breakable
public Breakable(float normalResistance, float tangentResistance, boolean breakBody, boolean breakBodyWithoutFixtures) - 
Breakable
 - 
Breakable
public Breakable(float normalResistance, float tangentResistance, boolean breakBody, Breakable.Callback callback) - 
Breakable
public Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance) - 
Breakable
public Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody) - 
Breakable
public Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, boolean breakBodyWithoutFixtures) - 
Breakable
public Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, Breakable.Callback callback) - 
Breakable
public Breakable(com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, Breakable.Callback callback) - 
Breakable
public Breakable(float normalResistance, float tangentResistance, com.badlogic.gdx.math.Vector2 reactionForceResistance, float reactionForceLength2Resistance, float reactionTorqueResistance, boolean breakBody, boolean breakBodyWithoutFixtures, Breakable.Callback callback)- Parameters:
 normalResistance- thenormalResistancetangentResistance- thetangentResistancereactionForceResistance- thereactionForceResistancereactionForceLength2Resistance- thereactionForceLength2ResistancereactionTorqueResistance- thereactionTorqueResistancebreakBody- thebreakBodybreakBodyWithoutFixtures- thebreakBodyWithoutFixturescallback- thecallback
 - 
Breakable
constructs a new Breakable exactly like the given other one 
 - 
 - 
Method Details
- 
getNormalResistance
public float getNormalResistance()- Returns:
 - the 
normalResistance 
 - 
setNormalResistance
public void setNormalResistance(float normalResistance)- Parameters:
 normalResistance- thenormalResistanceto set
 - 
getTangentResistance
public float getTangentResistance()- Returns:
 - the 
tangentResistance 
 - 
setTangentResistance
public void setTangentResistance(float tangentResistance)- Parameters:
 tangentResistance- thetangentResistanceto set
 - 
getReactionForceResistance
public com.badlogic.gdx.math.Vector2 getReactionForceResistance()- Returns:
 - the 
reactionForceResistance 
 - 
setReactionForceResistance
public void setReactionForceResistance(com.badlogic.gdx.math.Vector2 reactionForceResistance)- Parameters:
 reactionForceResistance- thereactionForceResistanceto set
 - 
getReactionForceLength2Resistance
public float getReactionForceLength2Resistance()- Returns:
 - the 
reactionForceLength2Resistance 
 - 
setReactionForceLength2Resistance
public void setReactionForceLength2Resistance(float reactionForceLength2Resistance)- Parameters:
 reactionForceLength2Resistance- thereactionForceLength2Resistanceto set
 - 
getReactionTorqueResistance
public float getReactionTorqueResistance()- Returns:
 - the 
reactionTorqueResistance 
 - 
setReactionTorqueResistance
public void setReactionTorqueResistance(float reactionTorqueResistance)- Parameters:
 reactionTorqueResistance- thereactionTorqueResistanceto set
 - 
isBreakBody
public boolean isBreakBody()- Returns:
 - the 
breakBody 
 - 
setBreakBody
public void setBreakBody(boolean breakBody)- Parameters:
 breakBody- thebreakBodyto set
 - 
isBreakBodyWithoutFixtures
public boolean isBreakBodyWithoutFixtures()- Returns:
 - the 
breakBodyWithoutFixtures 
 - 
setBreakBodyWithoutFixtures
public void setBreakBodyWithoutFixtures(boolean breakBodyWithoutFixtures)- Parameters:
 breakBodyWithoutFixtures- thebreakBodyWithoutFixturesto set
 - 
getCallback
- Returns:
 - the 
callback 
 - 
setCallback
- Parameters:
 callback- thecallbackto set
 
 -