Dart Documentationbox2dConstantVolumeJointDef

ConstantVolumeJointDef class

class ConstantVolumeJointDef extends JointDef {
 double frequencyHz;
 double dampingRatio;

 List<Body> bodies;
 List<DistanceJoint> joints;

 ConstantVolumeJointDef() :
   super(),
   bodies = new List<Body>(),
   joints = null,
   frequencyHz = 0.0,
   dampingRatio = 0.0 {
   type = JointType.CONSTANT_VOLUME;
   collideConnected = false;
 }

 /**
  * Adds a body to the group.
  */
 void addBody(Body argBody) {
   bodies.add(argBody);
   if (bodies.length == 1) {
     bodyA = argBody;
   } else if (bodies.length == 2) {
     bodyB = argBody;
   }
 }

 /**
  * Adds a body and the pre-made distance joint.  Should only
  * be used for deserialization.
  */
 void addBodyAndJoint(Body argBody, DistanceJoint argJoint) {
   addBody(argBody);
   if(joints == null){
     joints = new List<DistanceJoint>();
   }
   joints.add(argJoint);
 }
}

Extends

JointDef > ConstantVolumeJointDef

Constructors

new ConstantVolumeJointDef() #

ConstantVolumeJointDef() :
 super(),
 bodies = new List<Body>(),
 joints = null,
 frequencyHz = 0.0,
 dampingRatio = 0.0 {
 type = JointType.CONSTANT_VOLUME;
 collideConnected = false;
}

Properties

List<Body> bodies #

List<Body> bodies

Body bodyA #

inherited from JointDef

The first attached body.

Body bodyA

Body bodyB #

inherited from JointDef

The second attached body.

Body bodyB

bool collideConnected #

inherited from JointDef

Set this flag to true if the attached bodies should collide.

bool collideConnected

double dampingRatio #

double dampingRatio

double frequencyHz #

double frequencyHz

List<DistanceJoint> joints #

List<DistanceJoint> joints

int type #

inherited from JointDef

The joint type is set automatically for concrete joint types.

int type

var userData #

inherited from JointDef

Use this to attach application specific data to your joints.

dynamic userData

Methods

void addBody(Body argBody) #

Adds a body to the group.

void addBody(Body argBody) {
 bodies.add(argBody);
 if (bodies.length == 1) {
   bodyA = argBody;
 } else if (bodies.length == 2) {
   bodyB = argBody;
 }
}

void addBodyAndJoint(Body argBody, DistanceJoint argJoint) #

Adds a body and the pre-made distance joint. Should only be used for deserialization.

void addBodyAndJoint(Body argBody, DistanceJoint argJoint) {
 addBody(argBody);
 if(joints == null){
   joints = new List<DistanceJoint>();
 }
 joints.add(argJoint);
}