JointComponent Class
Base class for all physics joint components. Place this component on the entity that acts as body A. Set ConnectedBody to the other body (body B). The joint is created by Box2DPhysicsSystem once both bodies have live Box2D bodies, and destroyed automatically when this component is removed or either body is destroyed.
public abstract class JointComponent : Brine2D.ECS.Component
Inheritance System.Object → Component → JointComponent
Derived
↳ DistanceJointComponent
↳ MotorJointComponent
↳ MouseJointComponent
↳ PrismaticJointComponent
↳ RevoluteJointComponent
↳ WeldJointComponent
↳ WheelJointComponent
| Properties | |
|---|---|
| BreakForce | Maximum constraint force magnitude (in simulation force units: mass × pixels/s²) before the joint breaks. When the reaction force exceeds this value the joint is destroyed and OnBreak is fired. Default is System.Single.PositiveInfinity (never breaks). |
| BreakTorque | Maximum constraint torque magnitude (in simulation torque units: mass × pixels²/s²) before the joint breaks. When the reaction torque exceeds this value the joint is destroyed and OnBreak is fired. Default is System.Single.PositiveInfinity (never breaks). |
| CollideConnected | When true, the two joined bodies can still collide with each other. Default is false. |
| ConnectedBody | The other collider this joint is connected to (body B). The entity this component is attached to supplies body A via its own PhysicsBodyComponent. |
| IsLive | Returns true if the underlying Box2D joint has been created and is still valid. |
| LocalAnchorA | Local anchor point on body A, relative to its center of mass (pixels). |
| LocalAnchorB | Local anchor point on body B, relative to its center of mass (pixels). |
| RebuildAfterBreak | When true, a broken joint will be rebuilt automatically on the next physics step (if ConnectedBody is still valid). Default is false — the break is permanent unless the caller explicitly sets ConnectedBody again or sets this flag. To permanently break a joint at runtime, set ConnectedBody = null inside your OnBreak handler regardless of this flag. |
| Methods | |
|---|---|
| Build(PhysicsWorld, BodyId) | Creates the Box2D joint. Called by the physics system once both bodies are ready. |
| GetReactionForce() | Returns the constraint force exerted by this joint during the last step (simulation units). Returns System.Numerics.Vector2.Zero if the joint is not live. Useful for detecting overloaded joints or triggering break logic. |
| GetReactionTorque() | Returns the constraint torque exerted by this joint during the last step. Returns 0 if the joint is not live. |
| Events | |
|---|---|
| OnBreak | Fired once when this joint is destroyed for any reason: ... After this fires, IsLive is false. The joint will only rebuild automatically on the next step when RebuildAfterBreak is true. |