Abstract Class: Joint2DComponent
2D joints (Unity's Joint2D family). A joint sits on an entity with a Rigidbody2D and ties it to connectedBody — another Rigidbody2D, or the world when empty. Anchors are in each entity's local pixels. With autoConfigureConnectedAnchor the connected anchor is placed where this anchor is when the joint is created (and written back), so the bodies start where they are.
A joint with breakForce / breakTorque set breaks when its reaction exceeds them: it's disabled and the entity gets OnJointBreak2D. Physics2DSystem owns dirty: motor, limit and spring changes apply in place; anchor or body changes recreate the joint.
Extends
Extended by
DistanceJoint2DComponentSpringJoint2DComponentHingeJoint2DComponentFixedJoint2DComponentSliderJoint2DComponentWheelJoint2DComponentTargetJoint2DComponent
Constructors
Constructor
ts
new Joint2DComponent(): Joint2DComponent;Returns
Joint2DComponent
Inherited from
Properties
| Property | Modifier | Type | Default value | Inherited from |
|---|---|---|---|---|
anchorX | public | number | undefined | - |
anchorY | public | number | undefined | - |
autoConfigureConnectedAnchor | public | boolean | undefined | - |
breakForce | public | number | undefined | - |
breakTorque | public | number | undefined | - |
connectedAnchorX | public | number | undefined | - |
connectedAnchorY | public | number | undefined | - |
connectedBody | public | Rigidbody2DComponent | null | undefined | - |
dirty | public | boolean | true | Component.dirty |
enableCollision | public | boolean | undefined | - |
enabled | public | boolean | true | Component.enabled |
Accessors
isSimulated
Get Signature
ts
get isSimulated(): boolean;Returns
boolean
reactionForce
Get Signature
ts
get reactionForce(): PhysicsVec2;What the joint pulls on its body with (px units), last step.
Returns
reactionTorque
Get Signature
ts
get reactionTorque(): number;Returns
number