com.jmex.physics
Class JointAxis

java.lang.Object
  extended by com.jmex.physics.JointAxis
All Implemented Interfaces:
com.jme.util.export.Savable
Direct Known Subclasses:
RotationalJointAxis, TranslationalJointAxis

public abstract class JointAxis
extends java.lang.Object
implements com.jme.util.export.Savable

An axis for a Joint. An axis can belong to only one Joint. Each axis adds one degree of freedom to a joint.

Author:
Irrisor
See Also:
Joint, Joint.createRotationalAxis(), Joint.createTranslationalAxis()

Field Summary
static java.lang.String AVAILABLE_ACCELERATION_PROPERTY
           
static java.lang.String DESIRED_VELOCITY_PROPERTY
           
static java.lang.String DIRECTION_PROPERTY
           
static java.lang.String JOINT_PROPERTY
           
static java.lang.String POSITION_MAXIMUM_PROPERTY
           
static java.lang.String POSITION_MINIMUM_PROPERTY
           
static java.lang.String RELATIVE_TO_SECOND_OBJECT_PROPERTY
           
 
Method Summary
 void copy(JointAxis toCopy)
          Copy axis data from another axis.
abstract  float getAvailableAcceleration()
           
abstract  float getDesiredVelocity()
           
 com.jme.math.Vector3f getDirection(com.jme.math.Vector3f store)
          Query the direction of this axis.
 Joint getJoint()
           
abstract  float getPosition()
          Query position of the objects attached to this joint.
abstract  float getPositionMaximum()
           
abstract  float getPositionMinimum()
           
abstract  float getVelocity()
           
 boolean isRelativeToSecondObject()
          getter for field relativeToSecondObject
abstract  boolean isRotationalAxis()
           
abstract  boolean isTranslationalAxis()
           
 void read(com.jme.util.export.JMEImporter im)
           
static Joint readJointFromInputCapsule(com.jme.util.export.InputCapsule inputCapsule)
           
abstract  void setAvailableAcceleration(float value)
          Change the force the joint motor can use to reach the desired velocity.
abstract  void setDesiredVelocity(float value)
          Change the desired velocity.
 void setDirection(com.jme.math.Vector3f direction)
          Sets the direction of this axis.
abstract  void setPositionMaximum(float value)
          Change the largest allowed position.
abstract  void setPositionMinimum(float value)
          Change the smallest allowed position.
 void setRelativeToSecondObject(boolean value)
          setter for field relativeToSecondObject
 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
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

DIRECTION_PROPERTY

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

RELATIVE_TO_SECOND_OBJECT_PROPERTY

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

JOINT_PROPERTY

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

AVAILABLE_ACCELERATION_PROPERTY

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

DESIRED_VELOCITY_PROPERTY

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

POSITION_MAXIMUM_PROPERTY

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

POSITION_MINIMUM_PROPERTY

public static final java.lang.String POSITION_MINIMUM_PROPERTY
See Also:
Constant Field Values
Method Detail

getJoint

public Joint getJoint()

isTranslationalAxis

public abstract boolean isTranslationalAxis()
Returns:
true if this axis imposes translational freedom in the axis direction.

isRotationalAxis

public abstract boolean isRotationalAxis()
Returns:
true if this axis imposes rotational freedom around the axis direction.

setDirection

public void setDirection(com.jme.math.Vector3f direction)
Sets the direction of this axis.

Parameters:
direction - new direction in world coordinate space if the joint is attached to the world, object coordinate space if attached to two objects
See Also:
isRelativeToSecondObject()

getDirection

public com.jme.math.Vector3f getDirection(com.jme.math.Vector3f store)
Query the direction of this axis. The passed in Vector3f will be populated with the values, and then returned.

Parameters:
store - where to store the direction (null to create a new vector)
Returns:
store

getPosition

public abstract float getPosition()
Query position of the objects attached to this joint. For a translational axis this is in direction of this axis, for a rotational axis this is around the axis direction in radians.

Returns:
the relative position of the objects attached to the joint

getVelocity

public abstract float getVelocity()
Returns:
the relative velocity (translation/angular speed) of the objects attached to the joint in/around direction of this axis

setAvailableAcceleration

public abstract void setAvailableAcceleration(float value)
Change the force the joint motor can use to reach the desired velocity.

Parameters:
value - new acceleration than can be used
See Also:
setDesiredVelocity(float)

getAvailableAcceleration

public abstract float getAvailableAcceleration()
Returns:
the maximum force available to reach the desired velocity
See Also:
setAvailableAcceleration(float)

setDesiredVelocity

public abstract void setDesiredVelocity(float value)
Change the desired velocity. The joint motor uses the available linear acceleration to reach the specified velocity as fast as possible.

Parameters:
value - new desired linear velocity
See Also:
setAvailableAcceleration(float)

getDesiredVelocity

public abstract float getDesiredVelocity()
Returns:
the last set desired velocity
See Also:
setDesiredVelocity(float)

setPositionMinimum

public abstract void setPositionMinimum(float value)
Change the smallest allowed position.

Parameters:
value - smallest allowed position, Float.NEGATIVE_INFINITY to disable minimum

getPositionMinimum

public abstract float getPositionMinimum()
Returns:
smallest allowed position, Float.NEGATIVE_INFINITY if minimum is disabled

setPositionMaximum

public abstract void setPositionMaximum(float value)
Change the largest allowed position.

Parameters:
value - largest allowed position, Float.POSITIVE_INFINITY to disable maximum

getPositionMaximum

public abstract float getPositionMaximum()
Returns:
largest allowed position, Float.POSITIVE_INFINITY if maximum is disabled

copy

public void copy(JointAxis toCopy)
Copy axis data from another axis.

Parameters:
toCopy - where to read values from

isRelativeToSecondObject

public boolean isRelativeToSecondObject()
getter for field relativeToSecondObject

Returns:
true if this axis' direction is given in coordinates relative to the second object. The default is false which means it is relative to the first object (resp. the world)

setRelativeToSecondObject

public void setRelativeToSecondObject(boolean value)
setter for field relativeToSecondObject

Parameters:
value - new value

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

readJointFromInputCapsule

public static Joint readJointFromInputCapsule(com.jme.util.export.InputCapsule inputCapsule)
                                       throws java.io.IOException
Throws:
java.io.IOException