Skip to content

Segment Collider

The SegmentCollider defines a line segment between two points. It is useful for thin walls, one-way platforms, and invisible barriers that don’t need volumetric shape.

Properties

PropertyTypeDefaultDescription
point1Vec2{x: -0.5, y: 0}Start point in physics units (local space)
point2Vec2{x: 0.5, y: 0}End point in physics units (local space)
densitynumber1.0Mass density
frictionnumber0.6Surface friction
restitutionnumber0.0Bounciness
isSensorbooleanfalseTrigger zone without physical response
categoryBitsnumber1Collision filter category bits

Usage

Add a SegmentCollider component to any entity that also has a RigidBody and Transform.

Thin walls: Create invisible collision boundaries without using a full box shape.

commands.spawn(
Transform.default(),
RigidBody.with({ bodyType: 0 }),
SegmentCollider.with({
point1: { x: 0, y: 0 },
point2: { x: 0, y: 5 },
}),
);

One-way platforms: Combine with static body type to create edges that objects can land on.

Invisible barriers: Define play area boundaries without visible collider geometry.

See Also