org.xith3d.physics.util
Class BodyJointAnchorLink

java.lang.Object
  extended by org.xith3d.physics.util.BodyJointAnchorLink
All Implemented Interfaces:
org.jagatoo.datatypes.RepositionListener3f

public abstract class BodyJointAnchorLink
extends java.lang.Object
implements org.jagatoo.datatypes.RepositionListener3f

The BodyJointAnchorLink listens for Body-position-changes and adjusts a Joint's anchor accordingly.


Constructor Summary
protected BodyJointAnchorLink(Body body, boolean useOffset, float offsetX, float offsetY, float offsetZ)
           
 
Method Summary
 Body getBody()
           
abstract  Joint getJoint()
           
 org.openmali.vecmath2.Vector3f getOffset()
           
static BodyJointAnchorLink make(Body body, BallJoint joint, int anchorIndex)
          Creates a new BodyJointAnchorLink for a BallJoint.
static BodyJointAnchorLink make(Body body, BallJoint joint, int anchorIndex, float offsetX, float offsetY, float offsetZ)
          Creates a new BodyJointAnchorLink for a BallJoint.
static BodyJointAnchorLink make(Body body, Hinge2Joint joint)
          Creates a new BodyJointAnchorLink for a BallJoint.
static BodyJointAnchorLink make(Body body, Hinge2Joint joint, float offsetX, float offsetY, float offsetZ)
          Creates a new BodyJointAnchorLink for a BallJoint.
static BodyJointAnchorLink make(Body body, HingeJoint joint)
          Creates a new BodyJointAnchorLink for a BallJoint.
static BodyJointAnchorLink make(Body body, HingeJoint joint, float offsetX, float offsetY, float offsetZ)
          Creates a new BodyJointAnchorLink for a BallJoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jagatoo.datatypes.RepositionListener3f
onPositionChanged
 

Constructor Detail

BodyJointAnchorLink

protected BodyJointAnchorLink(Body body,
                              boolean useOffset,
                              float offsetX,
                              float offsetY,
                              float offsetZ)
Method Detail

getBody

public final Body getBody()

getOffset

public final org.openmali.vecmath2.Vector3f getOffset()

getJoint

public abstract Joint getJoint()

make

public static BodyJointAnchorLink make(Body body,
                                       BallJoint joint,
                                       int anchorIndex)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
anchorIndex - 1 for anchor 1, 2 for anchor 2
Returns:
the new BodyJointAnchorLink.

make

public static BodyJointAnchorLink make(Body body,
                                       BallJoint joint,
                                       int anchorIndex,
                                       float offsetX,
                                       float offsetY,
                                       float offsetZ)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
anchorIndex - 1 for anchor 1, 2 for anchor 2
offsetX -
offsetY -
offsetZ -
Returns:
the new BodyJointAnchorLink.

make

public static BodyJointAnchorLink make(Body body,
                                       HingeJoint joint)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
Returns:
the new BodyJointAnchorLink.

make

public static BodyJointAnchorLink make(Body body,
                                       HingeJoint joint,
                                       float offsetX,
                                       float offsetY,
                                       float offsetZ)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
offsetX -
offsetY -
offsetZ -
Returns:
the new BodyJointAnchorLink.

make

public static BodyJointAnchorLink make(Body body,
                                       Hinge2Joint joint)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
Returns:
the new BodyJointAnchorLink.

make

public static BodyJointAnchorLink make(Body body,
                                       Hinge2Joint joint,
                                       float offsetX,
                                       float offsetY,
                                       float offsetZ)
Creates a new BodyJointAnchorLink for a BallJoint.
The link is directly added to the Body as a RepositionListener3f.
You must remove it on your own in case.

Parameters:
body -
joint -
offsetX -
offsetY -
offsetZ -
Returns:
the new BodyJointAnchorLink.