Box2D. Box2dJoint

Box2D Joint

  • Base class for Box2D joints
  • A joint is used to connect objects together
  • Angular values are clockwise like angle: joint angles and speeds, limits, motor speeds and torques

Constructor

new Box2dJoint(jointDef)

Create a box2d joint, the base class is not intended to be used directly

Parameters:
NameTypeDescription
jointDefObject

Freed once the joint is made, Box2D copies it

Members

box2dJoint

Properties
TypeDescription
Object

The Box2d joint, 0 once it is destroyed, as it is when either object is

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

getCollideConnected() → {boolean}

Check if the connected bodies should collide

Returns:
Type: 
boolean

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(timeopt) → {Vector2}

Get the reaction force on bodyB at the joint anchor over the last step

Parameters:
NameTypeAttributesDescription
timenumber<optional>

The step length in seconds, the world steps by timeDelta

Returns:
Type: 
Vector2

getReactionTorque(timeopt) → {number}

Get the reaction torque on bodyB in N*m over the last step, clockwise like angle

Parameters:
NameTypeAttributesDescription
timenumber<optional>

The step length in seconds, the world steps by timeDelta

Returns:
Type: 
number

isActive() → {boolean}

Check if either connected body is active

Returns:
Type: 
boolean

isDestroyed() → {boolean}

Check if the joint is gone, destroyed or taken along with one of its objects; its other methods can not be used then

Returns:
Type: 
boolean