Skip to main content

Interface: LinearDamperEcsComponent

Defined in: physics/components/linear-damper-component.ts:16

ECS-style component interface for a velocity-based force connecting two bodies' anchor points, resisting the speed at which they move towards or away from each other along the line between them, per F = -c * v. Register createLinearDamperEcsSystem to have the force applied to bodyA/bodyB every tick while this component's entity exists. Used alongside a LinearSpringEcsComponent sharing the same anchors (a shock absorber pairs with a suspension spring) to dissipate the energy the spring stores and prevent endless bouncing.

Properties

anchorA

anchorA: Vector2

Defined in: physics/components/linear-damper-component.ts:25

The anchor point, relative to bodyA's center of mass and unrotated by bodyA's angle (i.e. in bodyA's local space).


anchorB

anchorB: Vector2

Defined in: physics/components/linear-damper-component.ts:31

The anchor point, relative to bodyB's center of mass and unrotated by bodyB's angle (i.e. in bodyB's local space).


bodyA

bodyA: RigidBody

Defined in: physics/components/linear-damper-component.ts:17


bodyB

bodyB: RigidBody

Defined in: physics/components/linear-damper-component.ts:19


dampingCoefficient

dampingCoefficient: number

Defined in: physics/components/linear-damper-component.ts:38

The damping constant (c in F = -c * v), in N·s/m. Higher values dissipate the anchors' relative compression/extension speed more strongly.