11 KiB
Planck.js API Doc › Globals › WeldJoint
Class: WeldJoint
A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate.
Hierarchy
-
↳ WeldJoint
Index
Constructors
Properties
Methods
- getAnchorA
- getAnchorB
- getBodyA
- getBodyB
- getCollideConnected
- getDampingRatio
- getFrequency
- getLocalAnchorA
- getLocalAnchorB
- getNext
- getReactionForce
- getReactionTorque
- getReferenceAngle
- getType
- getUserData
- initVelocityConstraints
- isActive
- setDampingRatio
- setFrequency
- setUserData
- shiftOrigin
- solvePositionConstraints
- solveVelocityConstraints
Constructors
constructor
+ new WeldJoint(def: WeldJointDef): WeldJoint
Overrides Joint.constructor
Defined in src/dynamics/joint/WeldJoint.ts:114
Parameters:
| Name | Type |
|---|---|
def |
WeldJointDef |
Returns: WeldJoint
+ new WeldJoint(def: WeldJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): WeldJoint
Overrides Joint.constructor
Defined in src/dynamics/joint/WeldJoint.ts:116
Parameters:
| Name | Type |
|---|---|
def |
WeldJointOpt |
bodyA |
Body |
bodyB |
Body |
anchor |
Vec2 |
Returns: WeldJoint
Properties
Static TYPE
▪ TYPE: "weld-joint" = 'weld-joint' as 'weld-joint'
Defined in src/dynamics/joint/WeldJoint.ts:90
Methods
getAnchorA
▸ getAnchorA(): Vec2
Overrides Joint.getAnchorA
Defined in src/dynamics/joint/WeldJoint.ts:268
Get the anchor point on bodyA in world coordinates.
Returns: Vec2
getAnchorB
▸ getAnchorB(): Vec2
Overrides Joint.getAnchorB
Defined in src/dynamics/joint/WeldJoint.ts:275
Get the anchor point on bodyB in world coordinates.
Returns: Vec2
getBodyA
▸ getBodyA(): Body
Defined in src/dynamics/Joint.ts:159
Get the first body attached to this joint.
Returns: Body
getBodyB
▸ getBodyB(): Body
Defined in src/dynamics/Joint.ts:166
Get the second body attached to this joint.
Returns: Body
getCollideConnected
▸ getCollideConnected(): boolean
Inherited from Joint.getCollideConnected
Defined in src/dynamics/Joint.ts:190
Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap.
Returns: boolean
getDampingRatio
▸ getDampingRatio(): number
Defined in src/dynamics/joint/WeldJoint.ts:261
Get damping ratio.
Returns: number
getFrequency
▸ getFrequency(): number
Defined in src/dynamics/joint/WeldJoint.ts:247
Get frequency in Hz.
Returns: number
getLocalAnchorA
▸ getLocalAnchorA(): Vec2
Defined in src/dynamics/joint/WeldJoint.ts:219
The local anchor point relative to bodyA's origin.
Returns: Vec2
getLocalAnchorB
▸ getLocalAnchorB(): Vec2
Defined in src/dynamics/joint/WeldJoint.ts:226
The local anchor point relative to bodyB's origin.
Returns: Vec2
getNext
▸ getNext(): Joint
Defined in src/dynamics/Joint.ts:173
Get the next joint the world joint list.
Returns: Joint
getReactionForce
▸ getReactionForce(inv_dt: number): Vec2
Overrides Joint.getReactionForce
Defined in src/dynamics/joint/WeldJoint.ts:282
Get the reaction force on bodyB at the joint anchor in Newtons.
Parameters:
| Name | Type |
|---|---|
inv_dt |
number |
Returns: Vec2
getReactionTorque
▸ getReactionTorque(inv_dt: number): number
Overrides Joint.getReactionTorque
Defined in src/dynamics/joint/WeldJoint.ts:289
Get the reaction torque on bodyB in N*m.
Parameters:
| Name | Type |
|---|---|
inv_dt |
number |
Returns: number
getReferenceAngle
▸ getReferenceAngle(): number
Defined in src/dynamics/joint/WeldJoint.ts:233
Get the reference angle.
Returns: number
getType
▸ getType(): string
Defined in src/dynamics/Joint.ts:152
Get the type of the concrete joint.
Returns: string
getUserData
▸ getUserData(): unknown
Inherited from Joint.getUserData
Defined in src/dynamics/Joint.ts:177
Returns: unknown
initVelocityConstraints
▸ initVelocityConstraints(step: TimeStep): void
Overrides Joint.initVelocityConstraints
Defined in src/dynamics/joint/WeldJoint.ts:293
Parameters:
| Name | Type |
|---|---|
step |
TimeStep |
Returns: void
isActive
▸ isActive(): boolean
Defined in src/dynamics/Joint.ts:145
Short-cut function to determine if either body is inactive.
Returns: boolean
setDampingRatio
▸ setDampingRatio(ratio: number): void
Defined in src/dynamics/joint/WeldJoint.ts:254
Set damping ratio.
Parameters:
| Name | Type |
|---|---|
ratio |
number |
Returns: void
setFrequency
▸ setFrequency(hz: number): void
Defined in src/dynamics/joint/WeldJoint.ts:240
Set frequency in Hz.
Parameters:
| Name | Type |
|---|---|
hz |
number |
Returns: void
setUserData
▸ setUserData(data: unknown): void
Inherited from Joint.setUserData
Defined in src/dynamics/Joint.ts:181
Parameters:
| Name | Type |
|---|---|
data |
unknown |
Returns: void
shiftOrigin
▸ shiftOrigin(newOrigin: Vec2): void
Inherited from Joint.shiftOrigin
Defined in src/dynamics/Joint.ts:217
Shift the origin for any points stored in world coordinates.
Parameters:
| Name | Type |
|---|---|
newOrigin |
Vec2 |
Returns: void
solvePositionConstraints
▸ solvePositionConstraints(step: TimeStep): boolean
Overrides Joint.solvePositionConstraints
Defined in src/dynamics/joint/WeldJoint.ts:463
This returns true if the position errors are within tolerance.
Parameters:
| Name | Type |
|---|---|
step |
TimeStep |
Returns: boolean
solveVelocityConstraints
▸ solveVelocityConstraints(step: TimeStep): void
Overrides Joint.solveVelocityConstraints
Defined in src/dynamics/joint/WeldJoint.ts:399
Parameters:
| Name | Type |
|---|---|
step |
TimeStep |
Returns: void