5.9 KiB
Planck.js API Doc › Globals › RevoluteJointDef
Interface: RevoluteJointDef
Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game.
The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.
Hierarchy
↳ JointDef
↳ RevoluteJointDef
Index
Properties
- bodyA
- bodyB
- collideConnected
- enableLimit
- enableMotor
- localAnchorA
- localAnchorB
- lowerAngle
- maxMotorTorque
- motorSpeed
- referenceAngle
- upperAngle
- userData
Properties
bodyA
• bodyA: Body
Defined in src/dynamics/Joint.ts:78
The first attached body.
bodyB
• bodyB: Body
Defined in src/dynamics/Joint.ts:82
The second attached body.
Optional collideConnected
• collideConnected? : boolean
Inherited from JointOpt.collideConnected
Overrides JointOpt.collideConnected
Defined in src/dynamics/Joint.ts:69
Set this flag to true if the attached bodies should collide.
Optional enableLimit
• enableLimit? : boolean
Inherited from RevoluteJointOpt.enableLimit
Defined in src/dynamics/joint/RevoluteJoint.ts:80
A flag to enable joint limits.
Optional enableMotor
• enableMotor? : boolean
Inherited from RevoluteJointOpt.enableMotor
Defined in src/dynamics/joint/RevoluteJoint.ts:84
A flag to enable the joint motor.
localAnchorA
• localAnchorA: Vec2
Defined in src/dynamics/joint/RevoluteJoint.ts:102
The local anchor point relative to bodyA's origin.
localAnchorB
• localAnchorB: Vec2
Defined in src/dynamics/joint/RevoluteJoint.ts:106
The local anchor point relative to bodyB's origin.
Optional lowerAngle
• lowerAngle? : number
Inherited from RevoluteJointOpt.lowerAngle
Defined in src/dynamics/joint/RevoluteJoint.ts:63
The lower angle for the joint limit (radians).
Optional maxMotorTorque
• maxMotorTorque? : number
Inherited from RevoluteJointOpt.maxMotorTorque
Defined in src/dynamics/joint/RevoluteJoint.ts:72
The maximum motor torque used to achieve the desired motor speed. Usually in N-m.
Optional motorSpeed
• motorSpeed? : number
Inherited from RevoluteJointOpt.motorSpeed
Defined in src/dynamics/joint/RevoluteJoint.ts:76
The desired motor speed. Usually in radians per second.
referenceAngle
• referenceAngle: number
Defined in src/dynamics/joint/RevoluteJoint.ts:110
The bodyB angle minus bodyA angle in the reference state (radians).
Optional upperAngle
• upperAngle? : number
Inherited from RevoluteJointOpt.upperAngle
Defined in src/dynamics/joint/RevoluteJoint.ts:67
The upper angle for the joint limit (radians).
Optional userData
• userData? : any
Inherited from JointOpt.userData
Defined in src/dynamics/Joint.ts:64
Use this to attach application specific data to your joints.