b2ShapeId b2CreateChainSegmentShape(b2BodyId bodyId, const b2ShapeDef* def, b2ChainSegment* chainSegment)
{
float lengthSqr = b2DistanceSquared(chainSegment->segment.point1, chainSegment->segment.point2);
if (lengthSqr <= B2_LINEAR_SLOP * B2_LINEAR_SLOP)
{
B2_ASSERT(false);
return b2_nullShapeId;
}
// Ensure the chain segment is orphaned.
chainSegment->chainId = B2_NULL_INDEX;
return b2CreateShape(bodyId, def, chainSegment, b2_chainSegmentShape);