Dart Documentationbox2dRevoluteJointDef

RevoluteJointDef class

class RevoluteJointDef extends JointDef {
 /**
  *  The local anchor point relative to body1's origin.
  */
 Vector2 localAnchorA;

 /**
  *  The local anchor point relative to body2's origin.
  */
 Vector2 localAnchorB;

 /**
  *  The body2 angle minus body1 angle in the reference state (radians).
  */
 double referenceAngle;

 /**
  *  A flag to enable joint limits.
  */
 bool enableLimit;

 /**
  *  The lower angle for the joint limit (radians).
  */
 double lowerAngle;

 /**
  *  The upper angle for the joint limit (radians).
  */
 double upperAngle;

 /**
  *  A flag to enable the joint motor.
  */
 bool enableMotor;

 /**
  *  The desired motor speed. Usually in radians per second.
  */
 double motorSpeed;

 /**
  *  The maximum motor torque used to achieve the desired motor speed.
  *  Usually in N-m.
  */
 double maxMotorTorque;

 RevoluteJointDef() :
   super(),
   localAnchorA = new Vector2(0.0, 0.0),
   localAnchorB = new Vector2(0.0, 0.0),
   referenceAngle = 0.0,
   lowerAngle = 0.0,
   upperAngle = 0.0,
   maxMotorTorque = 0.0,
   motorSpeed = 0.0,
   enableLimit = false,
   enableMotor = false {
   type = JointType.REVOLUTE;
 }

 /**
  * Initialize the bodies, anchors, and reference angle using the world
  * anchor.
  */
 void initialize(Body b1, Body b2, Vector2 anchor) {
   bodyA = b1;
   bodyB = b2;
   bodyA.getLocalPointToOut(anchor, localAnchorA);
   bodyB.getLocalPointToOut(anchor, localAnchorB);
   referenceAngle = bodyA.angle - bodyB.angle;
 }
}

Extends

JointDef > RevoluteJointDef

Constructors

new RevoluteJointDef() #

RevoluteJointDef() :
 super(),
 localAnchorA = new Vector2(0.0, 0.0),
 localAnchorB = new Vector2(0.0, 0.0),
 referenceAngle = 0.0,
 lowerAngle = 0.0,
 upperAngle = 0.0,
 maxMotorTorque = 0.0,
 motorSpeed = 0.0,
 enableLimit = false,
 enableMotor = false {
 type = JointType.REVOLUTE;
}

Properties

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

bool enableLimit #

A flag to enable joint limits.

bool enableLimit

bool enableMotor #

A flag to enable the joint motor.

bool enableMotor

Vector2 localAnchorA #

The local anchor point relative to body1's origin.

Vector2 localAnchorA

Vector2 localAnchorB #

The local anchor point relative to body2's origin.

Vector2 localAnchorB

double lowerAngle #

The lower angle for the joint limit (radians).

double lowerAngle

double maxMotorTorque #

The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

double maxMotorTorque

double motorSpeed #

The desired motor speed. Usually in radians per second.

double motorSpeed

double referenceAngle #

The body2 angle minus body1 angle in the reference state (radians).

double referenceAngle

int type #

inherited from JointDef

The joint type is set automatically for concrete joint types.

int type

double upperAngle #

The upper angle for the joint limit (radians).

double upperAngle

var userData #

inherited from JointDef

Use this to attach application specific data to your joints.

dynamic userData

Methods

void initialize(Body b1, Body b2, Vector2 anchor) #

Initialize the bodies, anchors, and reference angle using the world anchor.

void initialize(Body b1, Body b2, Vector2 anchor) {
 bodyA = b1;
 bodyB = b2;
 bodyA.getLocalPointToOut(anchor, localAnchorA);
 bodyB.getLocalPointToOut(anchor, localAnchorB);
 referenceAngle = bodyA.angle - bodyB.angle;
}