Documentation
    Preparing search index...

    Function capsuleGeometry

    • A capsule about the +Y axis — a cylinder of height closed by two hemispheres of radius — centred on the origin (§53 "capsule").

      const geometry = capsuleGeometry({ radius: 0.3, height: 1 });
      geometry.computeBounds(); // y spans ±(height / 2 + radius)

      The whole surface is one grid, hemispheres and cylinder alike: the cylindrical band is simply the pair of rings whose normals are exactly radial, so there is no seam ring to weld, no duplicated vertices at the tangency, and one uv chart over the lot. Normals are analytic — radial about the cap centre on a hemisphere and about the axis on the cylinder — which is what makes the tangent circle shade continuously.

      height measures the cylindrical section only, matching §24's capsule collider, so the total extent along Y is height + 2 · radius. v runs 0 at the bottom tip to 1 at the top tip, uniformly in ring index rather than in arc length: the caps therefore take capSegments / (2·capSegments+1) of the texture each, whatever the cylinder's length. A texture that must not stretch at the caps is a uv-parameterization option for the packet that needs one (decision, R-20).

      Parameters

      Returns BufferGeometry