โ† All examples

mesh algorithms

Capsule with hemispherical caps

Build a capsule (a cylinder capped by two hemispheres) along Y with unit normals and UVs that follow the profile length. Use it for character colliders, pills and rounded rods.

Recorded render of Capsule with hemispherical caps

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • capsule.py
  • component.json
  • example.gltf
  • meshkit.py
  • preview.png
  • test_package.py
  • verification/native.json

How it works

Entry points
capsule_profile, capsule, main
Parameters
radius, length, segments, cap_rings
Complexity
O(segments * cap_rings)
Axes
+Y up, metres

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • generator_runs_system_python
  • generator_runs_verifier_python
  • gltf_strict_structure
  • interpreters_agree
  • example_matches_generator
  • godot_headless_gltf_load
  • godot_compatibility_render

Limits to consider

The equator rows are doubled (one ring for each hemisphere), so the straight part has exactly one row of quads. The seam and the pole vertices are duplicated for texture coordinates, so the mesh is closed after welding.