Box2dMotorJoint

Box2D Motor Joint

  • Controls the relative motion between two objects
  • Typical usage is to control the movement of a object with respect to the ground

Constructor

new Box2dMotorJoint(objectA, objectB)

Create a motor joint

Parameters:
NameTypeDescription
objectABox2dObject
objectBBox2dObject

Extends

Methods

destroy()

Destroy this joint

getAnchorA() → {Vector2}

Get the first anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getAnchorB() → {Vector2}

Get the second anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getAngularOffset() → {number}

Get the target angular offset

Returns:
Type: 
number

getCollideConnected() → {boolean}

Check if the connected bodies should collide

Returns:
Type: 
boolean

getCorrectionFactor() → {number}

Get the position correction factor in the range [0,1]

Returns:
Type: 
number

getLinearOffset() → {Vector2}

Get the target linear offset, in frame A, in meters.

Returns:
Type: 
Vector2

getMaxForce() → {number}

Get the maximum friction force

Returns:
Type: 
number

getMaxTorque() → {number}

Get the maximum torque

Returns:
Type: 
number

getObjectA() → {Box2dObject}

Get the first object attached to this joint

Returns:
Type: 
Box2dObject

getObjectB() → {Box2dObject}

Get the second object attached to this joint

Returns:
Type: 
Box2dObject

getReactionForce(time) → {Vector2}

Get the reaction force on bodyB at the joint anchor given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
Vector2

getReactionTorque(time) → {number}

Get the reaction torque on bodyB in N*m given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
number

isActive() → {boolean}

Check if either connected body is active

Returns:
Type: 
boolean

setAngularOffset(offset)

Set the target angular offset

Parameters:
NameTypeDescription
offsetnumber

setCorrectionFactor(factor)

Set the position correction factor in the range [0,1]

Parameters:
NameTypeDescription
factornumber

setLinearOffset(offset)

Set the target linear offset, in frame A, in meters.

Parameters:
NameTypeDescription
offsetVector2

setMaxForce(force)

Set the maximum friction force

Parameters:
NameTypeDescription
forcenumber

setMaxTorque(torque)

Set the maximum torque

Parameters:
NameTypeDescription
torquenumber