# Class: djoint

Joints are connecting bodies. They simulate contacts, varius hinges and slider joints. For example if a chair stands on the floor, each of his foots are connected with a djointcontact to the floor or if a car steers with the wheels, ODE uses a jointhinge2 to simulate this. Ragdoll physics is also a typical example.

## Hierarchy

    o-+ ode
      o-+ djoint
        o-- djointamotor
        o-- djointball
        o-- djointcontact
        o-- djointfixed
        o-- djointhinge
        o-- djointhinge2
        o-- djointslider
        o-- djointuniversal

## Interfaces:

- hashid

## Methods:

### Method overview:

- attach
- body1
- body2
- bounce
- bounce2
- bounce3
- cfm
- cfm2
- cfm3
- delete
- feedback
- fmax
- fmax2
- fmax3
- fudgefactor
- fudgefactor2
- fudgefactor3
- geom1
- geom2
- histop
- histop2
- histop3
- lostop
- lostop2
- lostop3
- stopcfm
- stopcfm2
- stopcfm3
- stoperp
- stoperp2
- stoperp3
- velocity
- velocity2
- velocity3

attach (djoint,[dbody],[dbody])
  returns: ()
  connects the joint to one or two bodies. Some joints may need two bodies while other joints will merely accept anything. If nothing is passed, the joint is removed from the bodies it was attached to.
body1 (djoint)
  returns: ([dbody])
  returns body1 of the joint or nil if not connected
body2 (djoint)
  returns: ([dbody])
  returns body2 of the joint or nil if not connected
bounce (djoint,[float])
  returns: ([float])
  The bouncyness of the stops. This is a restitution parameter in the range 0..1. 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
bounce2 (djoint,[float])
  returns: ([float])
  same as bounce but for the 2nd axis (if exits)
bounce3 (djoint,[float])
  returns: ([float])
  same as bounce but for the 3rd axis (if exits)
cfm (djoint,[float])
  returns: ([float])
  The constraint force mixing (CFM) value used when not at a stop.
cfm2 (djoint,[float])
  returns: ([float])
  same as cfm but for the 2nd axis (if exists)
cfm3 (djoint,[float])
  returns: ([float])
  same as cfm but for the 3rd axis (if exists)
delete (djoint)
  returns: ()
  deletes the joint, making it invalid.
feedback (djoint)
  returns: ([float xf1,yf1,zf1, xt1,yt1,zt1, xf2,yf2,zf2, xt2,yt2,zt2)
  returns force and torque applied to the connected bodies of the joint. Since some joints must not be connected to two bodies, either the force and torque of body1 or body2 may not be valid.
fmax (djoint,[float])
  returns: ([float])
  The maximum force or torque that the motor will use to achieve the desired velocity. This must always be greater than or equal to zero. Setting this to zero (the default value) turns off the motor.
fmax2 (djoint,[float])
  returns: ([float])
  same as fmax but for axis 2
fmax3 (djoint,[float])
  returns: ([float])
  same as fmax but for axis 3
fudgefactor (djoint,[float])
  returns: ([float])
  The current joint stop/motor implementation has a small problem: when the joint is at one stop and the motor is set to move it away from the stop, too much force may be applied for one time step, causing a 'jumping' motion. This fudge factor is used to scale this excess force. It should have a value between zero and one (the default value). If the jumping motion is too visible in a joint, the value can be reduced. Making this value too small can prevent the motor from being able to move the joint away from a stop.
fudgefactor2 (djoint,[float])
  returns: ([float])
  same as fudgefactor but for axis 2
fudgefactor3 (djoint,[float])
  returns: ([float])
  same as fudgefactor but for axis 3
geom1 (djoint)
  returns: ([dgeom])
  returns geom1 of the joint it has collided with
geom2 (djoint)
  returns: ([dgeom])
  returns geom2 of the joint it has collided with
histop (djoint,[float])
  returns: ([float])
  High stop angle or position. Setting this to dInfinity (the default value) turns off the high stop. For rotational joints, this stop must be less than pi to be effective. If the high stop is less than the low stop then both stops will be ineffective.
histop2 (djoint,[float])
  returns: ([float])
  same as histop but for the 2nd axis (if exists)
histop3 (djoint,[float])
  returns: ([float])
  same as histop but for the 3rd axis (if exists)
lostop (djoint,[float])
  returns: ([float])
  Low stop angle or position. Setting this to -dInfinity (the default value) turns off the low stop. For rotational joints, this stop must be greater than - pi to be effective.
lostop2 (djoint,[float])
  returns: ([float])
  same as lostop but for the 2nd axis (if exists)
lostop3 (djoint,[float])
  returns: ([float])
  same as lostop but for the 3rd axis (if exists)
stopcfm (djoint,[float])
  returns: ([float])
  The constraint force mixing (CFM) value used by the stops. Together with the ERP value this can be used to get spongy or soft stops. Note that this is intended for unpowered joints, it does not really work as expected when a powered joint reaches its limit.
stopcfm2 (djoint,[float])
  returns: ([float])
  same as stopcfm
stopcfm3 (djoint,[float])
  returns: ([float])
  same as stopcfm
stoperp (djoint,[float])
  returns: ([float])
  The error reduction parameter (ERP) used by the stops.
stoperp2 (djoint,[float])
  returns: ([float])
  same as stoperp
stoperp3 (djoint,[float])
  returns: ([float])
  same as stoperp
velocity (djoint,[float])
  returns: ([float])
  Desired motor velocity axis 1(this will be an angular or linear velocity).
velocity2 (djoint,[float])
  returns: ([float])
  Desired motor velocity axis 2
velocity3 (djoint,[float])
  returns: ([float])
  Desired motor velocity axis 3

## Inherited Methods: