SegmentShape(Vector2, Vector2) Constructor
Definition
Namespace: Brine2D.Physics
Single line segment in local body space.
One-sided collision: segment shapes only collide with shapes approaching from
the outward normal side. The outward normal is the left-hand perpendicular
of the direction Point1 → Point2 — i.e. rotating (Point2 - Point1)
90° counter-clockwise. Shapes that contact the segment from the opposite (back) side
pass straight through without generating any collision response. This makes segment
shapes useful for one-way platforms and directional blockers, but unsuitable for
closed geometry where back-face hits must be resolved.
Use cases: one-way platforms (horizontal segment, normal pointing up), directional walls, simple ramp surfaces. For smooth multi-segment terrain that avoids ghost collisions at joints, prefer ChainShape, which Box2D handles as a single continuous surface. For a two-sided collidable edge, use a very thin CapsuleShape or a narrow BoxShape.
Static geometry only: dynamic bodies with segment shapes behave unpredictably under rotation and are not supported by Box2D.
Parameters
Point1 System.Numerics.Vector2
Start of the segment in local body space \(pixels\).
Point2 System.Numerics.Vector2
End of the segment in local body space \(pixels\).