Moscrif API Docs for: 2012q3
Show:

b2PrismaticJoint Class

Library: box2d

A prismatic joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.

Example:

// create the prismatic joint
// set joint
var jointDef = {
    lowerTranslation    : -3.0, // meters
    upperTranslation    : 5.0,  // meters
    enableLimit         : true,
    enableMotor         : true,
    motorSpeed          : 1.0,
    maxMotorForce       : 100.0,
}
this._prismaticJoint = this.createPrismaticJoint(this._ground, this._rect1, System.width / 2, System.height / 2, 0.0, 1.0, 0.0, jointDef, true)

Methods

getLimits

() Multivalue

Another way to get lower and upper limit.

Returns:

Multivalue: Pair of float values: lower and upper limit.

setLimits

(
  • lower
  • upper
)

Another way to set lower and upper limit.

Parameters:

  • lower Float

    The lower joint limit, usually in meters.

  • upper Float

    The upper joint limit, usually in meters.

Properties

enableLimit

Boolean

Enable / disable the joint limit.

enableMotor

Boolean

Enable / disable the joint motor.

lowerLimit

Float

The lower joint limit, usually in meters.

motorForce

Float

The current motor force, usually in N.

motorSpeed

Float

The motor speed, usually in meters per second.

upperLimit

Float

The upper joint limit, usually in meters.