com.jmex.physics.contact
Class MutableContactInfo

java.lang.Object
  extended by com.jmex.physics.contact.MutableContactInfo
All Implemented Interfaces:
com.jme.util.export.Savable, ContactHandlingDetails
Direct Known Subclasses:
PendingContact

public class MutableContactInfo
extends java.lang.Object
implements ContactHandlingDetails

Helper class to specify contact details.

Author:
Irrisor
See Also:
ContactHandlingDetails

Field Summary
static java.lang.String APPLIED_PROPERTY
           
static java.lang.String BOUNCE_PROPERTY
           
static java.lang.String DAMPING_COEFFICIENT_PROPERTY
           
static java.lang.String FRICTION_DIRECTION_PROPERTY
           
static java.lang.String IGNORED_PROPERTY
           
static java.lang.String MINIMUM_BOUNCE_VELOCITY_PROPERTY
           
static java.lang.String MU_ORTHOGONAL_PROPERTY
           
static java.lang.String MU_PROPERTY
           
static java.lang.String SLIP_PROPERTY
           
static java.lang.String SPRING_CONSTANT_PROPERTY
           
static java.lang.String SURFACE_MOTION_PROPERTY
           
 
Constructor Summary
MutableContactInfo()
          Default ctor.
MutableContactInfo(ContactHandlingDetails toCopy)
          Copy ctor.
 
Method Summary
 void clear()
           
 void copy(ContactHandlingDetails details)
          Copy contact details into this pending contact.
 float getBounce()
           
 java.lang.Class getClassTag()
           
 float getDampingCoefficient()
          If spring constant and damping coefficient are not NaN they make the contact 'softer' like a spring.
 com.jme.math.Vector3f getFrictionDirection(com.jme.math.Vector3f store)
          Query the direction for the friction - TODO: remove this?
 float getMinimumBounceVelocity()
           
 float getMu()
           
 float getMuOrthogonal()
           
 com.jme.math.Vector3f getSecondaryFrictionDirection(com.jme.math.Vector3f store)
          Query the direction for the secondary friction - TODO: remove this?
 com.jme.math.Vector2f getSlip(com.jme.math.Vector2f store)
           
 float getSpringConstant()
          If spring constant and damping coefficient are not NaN they make the contact 'softer' like a spring.
 com.jme.math.Vector2f getSurfaceMotion(com.jme.math.Vector2f store)
           
 boolean isApplied()
           
 boolean isIgnored()
           
 void read(com.jme.util.export.JMEImporter im)
           
 void setApplied(boolean value)
           
 void setBounce(float bounce)
          Restitution parameter (0..1).
 void setDampingCoefficient(float value)
           
 void setFrictionDirection(com.jme.math.Vector3f direction)
           
 void setIgnored(boolean value)
           
 void setMinimumBounceVelocity(float minimumBounceVelocity)
          The minimum incoming velocity necessary for bounce (in m/s).
 void setMu(float mu)
          Coulomb friction coefficient.
 void setMuOrthogonal(float muOrthogonal)
          Optional Coulomb friction coefficient for orthogonal friction direction (0..Infinity).
 void setSecondaryFrictionDirection(com.jme.math.Vector3f direction)
           
 void setSlip(com.jme.math.Vector2f slip)
          The coefficients of force-dependent-slip (FDS).
 void setSpringConstant(float value)
           
 void setSurfaceMotion(com.jme.math.Vector2f motion)
          Surface velocity - if set, the contact surface is assumed to be moving independently of the motion of the nodes.
 void write(com.jme.util.export.JMEExporter ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORED_PROPERTY

public static final java.lang.String IGNORED_PROPERTY
See Also:
Constant Field Values

MU_PROPERTY

public static final java.lang.String MU_PROPERTY
See Also:
Constant Field Values

MU_ORTHOGONAL_PROPERTY

public static final java.lang.String MU_ORTHOGONAL_PROPERTY
See Also:
Constant Field Values

BOUNCE_PROPERTY

public static final java.lang.String BOUNCE_PROPERTY
See Also:
Constant Field Values

MINIMUM_BOUNCE_VELOCITY_PROPERTY

public static final java.lang.String MINIMUM_BOUNCE_VELOCITY_PROPERTY
See Also:
Constant Field Values

SURFACE_MOTION_PROPERTY

public static final java.lang.String SURFACE_MOTION_PROPERTY
See Also:
Constant Field Values

SLIP_PROPERTY

public static final java.lang.String SLIP_PROPERTY
See Also:
Constant Field Values

APPLIED_PROPERTY

public static final java.lang.String APPLIED_PROPERTY
See Also:
Constant Field Values

FRICTION_DIRECTION_PROPERTY

public static final java.lang.String FRICTION_DIRECTION_PROPERTY
See Also:
Constant Field Values

SPRING_CONSTANT_PROPERTY

public static final java.lang.String SPRING_CONSTANT_PROPERTY
See Also:
Constant Field Values

DAMPING_COEFFICIENT_PROPERTY

public static final java.lang.String DAMPING_COEFFICIENT_PROPERTY
See Also:
Constant Field Values
Constructor Detail

MutableContactInfo

public MutableContactInfo()
Default ctor.


MutableContactInfo

public MutableContactInfo(ContactHandlingDetails toCopy)
Copy ctor.

Parameters:
toCopy - details to copy
Method Detail

isIgnored

public boolean isIgnored()
Specified by:
isIgnored in interface ContactHandlingDetails
Returns:
true if the contact should be completely ignored (no collision, no events)
See Also:
ContactHandlingDetails.isApplied()

setIgnored

public void setIgnored(boolean value)

isApplied

public boolean isApplied()
Specified by:
isApplied in interface ContactHandlingDetails
Returns:
true if this contact should be applied to the physics simulation (default), false to generate events only
See Also:
ContactHandlingDetails.isIgnored()

setApplied

public void setApplied(boolean value)

clear

public void clear()

getMu

public float getMu()
Specified by:
getMu in interface ContactHandlingDetails
Returns:
friction coefficient
See Also:
setMu(float)

setMu

public void setMu(float mu)
Coulomb friction coefficient. This must be in the range 0 to Float.POSITIVE_INFINITY. 0 results in a frictionless contact, and infinity results in a contact that never slips. Note that frictionless contacts are less time consuming to compute than ones with friction, and infinite friction contacts can be cheaper than contacts with finite friction. Friction must always be set.

Parameters:
mu - friction coefficient

getMuOrthogonal

public float getMuOrthogonal()
Specified by:
getMuOrthogonal in interface ContactHandlingDetails
Returns:
othogonal friction coefficient
See Also:
setMuOrthogonal(float)

setMuOrthogonal

public void setMuOrthogonal(float muOrthogonal)
Optional Coulomb friction coefficient for orthogonal friction direction (0..Infinity). The direction for this coefficient is orthogonal to the friction direction and the contact normal.

Parameters:
muOrthogonal - othogonal friction coefficient

getBounce

public float getBounce()
Specified by:
getBounce in interface ContactHandlingDetails
Returns:
bounce parameter
See Also:
setBounce(float)

setBounce

public void setBounce(float bounce)
Restitution parameter (0..1). 0 means the surfaces are not bouncy at all, 1 is maximum bouncyness.

Parameters:
bounce - bouncyness

getMinimumBounceVelocity

public float getMinimumBounceVelocity()
Specified by:
getMinimumBounceVelocity in interface ContactHandlingDetails
Returns:
minimum bounce velocity
See Also:
setMinimumBounceVelocity(float)

setMinimumBounceVelocity

public void setMinimumBounceVelocity(float minimumBounceVelocity)
The minimum incoming velocity necessary for bounce (in m/s). Incoming velocities below this will effectively have a bounce parameter of 0.

Parameters:
minimumBounceVelocity - new value

setSurfaceMotion

public void setSurfaceMotion(com.jme.math.Vector2f motion)
Surface velocity - if set, the contact surface is assumed to be moving independently of the motion of the nodes. This is kind of like a conveyor belt running over the surface. The x component of the vector specifies motion in friction direction and the y component specifies motion in direction orthogonal to friction direction and normal.

Parameters:
motion - new value, (0, 0) for no motion (not NaN)

getSurfaceMotion

public com.jme.math.Vector2f getSurfaceMotion(com.jme.math.Vector2f store)
Specified by:
getSurfaceMotion in interface ContactHandlingDetails
Parameters:
store - where to store the retrieved value (null to create a new vector)
Returns:
surface motion
See Also:
setSurfaceMotion(com.jme.math.Vector2f)

setSlip

public void setSlip(com.jme.math.Vector2f slip)
The coefficients of force-dependent-slip (FDS). The x component of the vector specifies motion in friction direction and the y component specifies motion in direction orthogonal to friction direction and normal.

Parameters:
slip - slip vector

getSlip

public com.jme.math.Vector2f getSlip(com.jme.math.Vector2f store)
Specified by:
getSlip in interface ContactHandlingDetails
Parameters:
store - where to store the retrieved value (null to create a new vector)
Returns:
slip
See Also:
setSlip(com.jme.math.Vector2f)

copy

public void copy(ContactHandlingDetails details)
Copy contact details into this pending contact.

Parameters:
details - copy source

setFrictionDirection

public void setFrictionDirection(com.jme.math.Vector3f direction)

getFrictionDirection

public com.jme.math.Vector3f getFrictionDirection(com.jme.math.Vector3f store)
Description copied from interface: ContactHandlingDetails
Query the direction for the friction - TODO: remove this?

Specified by:
getFrictionDirection in interface ContactHandlingDetails
Parameters:
store - where to put the value, null to create a new Vector
Returns:
store

setSecondaryFrictionDirection

public void setSecondaryFrictionDirection(com.jme.math.Vector3f direction)

getSecondaryFrictionDirection

public com.jme.math.Vector3f getSecondaryFrictionDirection(com.jme.math.Vector3f store)
Description copied from interface: ContactHandlingDetails
Query the direction for the secondary friction - TODO: remove this?

Specified by:
getSecondaryFrictionDirection in interface ContactHandlingDetails
Parameters:
store - where to put the value, null to create a new Vector
Returns:
store

setSpringConstant

public final void setSpringConstant(float value)

getSpringConstant

public final float getSpringConstant()
Description copied from interface: ContactHandlingDetails
If spring constant and damping coefficient are not NaN they make the contact 'softer' like a spring.

Specified by:
getSpringConstant in interface ContactHandlingDetails
Returns:
the spring constant used for this contact, NaN if not used
See Also:
ContactHandlingDetails.getDampingCoefficient()

setDampingCoefficient

public final void setDampingCoefficient(float value)

getDampingCoefficient

public final float getDampingCoefficient()
Description copied from interface: ContactHandlingDetails
If spring constant and damping coefficient are not NaN they make the contact 'softer' like a spring.

Specified by:
getDampingCoefficient in interface ContactHandlingDetails
Returns:
the damping coefficient used for this contact, NaN if not used
See Also:
ContactHandlingDetails.getSpringConstant()

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface com.jme.util.export.Savable

read

public void read(com.jme.util.export.JMEImporter im)
          throws java.io.IOException
Specified by:
read in interface com.jme.util.export.Savable
Throws:
java.io.IOException

write

public void write(com.jme.util.export.JMEExporter ex)
           throws java.io.IOException
Specified by:
write in interface com.jme.util.export.Savable
Throws:
java.io.IOException