Class b2DistanceJoint

A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

Hierarchy

Index

Methods

Methods

public GetAnchorA(): b2Vec2

Get the anchor point on bodyA in world coordinates.

Returns

b2Vec2

Body A anchor.

public GetAnchorB(): b2Vec2

Get the anchor point on bodyB in world coordinates.

Returns

b2Vec2

Body B anchor.

public GetBodyA(): b2Body

Get the first body attached to this joint.

Returns

b2Body

Body A.

public GetBodyB(): b2Body

Get the second body attached to this joint.

Returns

b2Body

Body B.

public GetDampingRatio(): number

Gets the damping ratio.

Returns

number

Damping ratio.

public GetFrequency(): number

Gets the frequency.

Returns

number

Frequency.

public GetLength(): number

Gets the length of distance between the two bodies.

Returns

number

Length.

public GetNext(): b2Joint

Get the next joint the world joint list.

Returns

b2Joint

Next joint.

public GetReactionForce(inv_dt: number): b2Vec2

Get the reaction force on body2 at the joint anchor in N.

Parameters

  • inv_dt: number

Returns

b2Vec2

Reaction force in N.

public GetReactionTorque(inv_dt: number): number

Get the reaction torque on body 2 in N.

Parameters

  • inv_dt: number

Returns

number

Reaction torque in N.

public GetType(): number

Get the type of the concrete joint.

Returns

number

Joint type.

public GetUserData(): any

Get the user data pointer.

Returns

any

User data. Cast to your data type.

public IsActive(): boolean

Short-cut function to determine if either body is inactive.

Returns

boolean

True if active, otherwise false.

public SetDampingRatio(ratio: number)

Sets the damping ratio.

Parameters

  • ratio: number

    New damping ratio.

public SetFrequency(hz: number)

Sets the frequency.

Parameters

  • hz: number

    New frequency (hertz).

public SetLength(length: number)

Sets the length of distance between the two bodies.

Parameters

  • length: number

    New length.

public SetUserData(data: any)

Set the user data pointer.

Parameters

  • data: any

    Your custom data.