11 KiB
Planck.js API Doc › Globals › FrictionJoint
Class: FrictionJoint
Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction.
param Anchor in global coordination.
Hierarchy
-
↳ FrictionJoint
Index
Constructors
Properties
Methods
- getAnchorA
- getAnchorB
- getBodyA
- getBodyB
- getCollideConnected
- getLocalAnchorA
- getLocalAnchorB
- getMaxForce
- getMaxTorque
- getNext
- getReactionForce
- getReactionTorque
- getType
- getUserData
- initVelocityConstraints
- isActive
- setMaxForce
- setMaxTorque
- setUserData
- shiftOrigin
- solvePositionConstraints
- solveVelocityConstraints
Constructors
constructor
+ new FrictionJoint(def: FrictionJointDef): FrictionJoint
Overrides Joint.constructor
Defined in src/dynamics/joint/FrictionJoint.ts:99
Parameters:
| Name | Type |
|---|---|
def |
FrictionJointDef |
Returns: FrictionJoint
+ new FrictionJoint(def: FrictionJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): FrictionJoint
Overrides Joint.constructor
Defined in src/dynamics/joint/FrictionJoint.ts:101
Parameters:
| Name | Type |
|---|---|
def |
FrictionJointOpt |
bodyA |
Body |
bodyB |
Body |
anchor |
Vec2 |
Returns: FrictionJoint
Properties
Static TYPE
▪ TYPE: "friction-joint" = 'friction-joint' as 'friction-joint'
Defined in src/dynamics/joint/FrictionJoint.ts:78
Methods
getAnchorA
▸ getAnchorA(): Vec2
Overrides Joint.getAnchorA
Defined in src/dynamics/joint/FrictionJoint.ts:244
Get the anchor point on bodyA in world coordinates.
Returns: Vec2
getAnchorB
▸ getAnchorB(): Vec2
Overrides Joint.getAnchorB
Defined in src/dynamics/joint/FrictionJoint.ts:251
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
getLocalAnchorA
▸ getLocalAnchorA(): Vec2
Defined in src/dynamics/joint/FrictionJoint.ts:200
The local anchor point relative to bodyA's origin.
Returns: Vec2
getLocalAnchorB
▸ getLocalAnchorB(): Vec2
Defined in src/dynamics/joint/FrictionJoint.ts:207
The local anchor point relative to bodyB's origin.
Returns: Vec2
getMaxForce
▸ getMaxForce(): number
Defined in src/dynamics/joint/FrictionJoint.ts:222
Get the maximum friction force in N.
Returns: number
getMaxTorque
▸ getMaxTorque(): number
Defined in src/dynamics/joint/FrictionJoint.ts:237
Get the maximum friction torque in N*m.
Returns: number
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/FrictionJoint.ts:258
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/FrictionJoint.ts:265
Get the reaction torque on bodyB in N*m.
Parameters:
| Name | Type |
|---|---|
inv_dt |
number |
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/FrictionJoint.ts:269
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
setMaxForce
▸ setMaxForce(force: number): void
Defined in src/dynamics/joint/FrictionJoint.ts:214
Set the maximum friction force in N.
Parameters:
| Name | Type |
|---|---|
force |
number |
Returns: void
setMaxTorque
▸ setMaxTorque(torque: number): void
Defined in src/dynamics/joint/FrictionJoint.ts:229
Set the maximum friction torque in N*m.
Parameters:
| Name | Type |
|---|---|
torque |
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/FrictionJoint.ts:407
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/FrictionJoint.ts:345
Parameters:
| Name | Type |
|---|---|
step |
TimeStep |
Returns: void