natiny_mesh_capsule
C
NatinyMesh natiny_mesh_capsule(float radius, float height, uint32_t segments, uint32_t rings);
Builds a one-part capsule standing upright along Y and centred on the origin:
a cylindrical side closed by a hemisphere at each end. The generated mesh has
normals and UV coordinates but no texture.
Parameters
| Name |
Type |
Description |
radius |
float |
Radius of the side and of both hemispheres; negative values are clamped to 0 |
height |
float |
Total height end to end, hemispheres included |
segments |
uint32_t |
Meridians - the detail around the Y axis; clamped up to 3 |
rings |
uint32_t |
Rings per hemisphere - the detail from equator to pole; clamped up to 1 |
Returns
| Type |
Description |
NatinyMesh |
Mesh handle |
Example
C
NatinyMesh capsule = natiny_mesh_capsule(0.4f, 1.8f, 32, 8);
NatinyModel player = natiny_model_create();
natiny_model_set_mesh(player, capsule);
Notes
- A
height at or below 2 * radius produces a sphere: the side is clamped to
zero height rather than inverted, and the band that would draw it is skipped.