Cylinder

fun FilamentSceneScope.Cylinder(material: MaterialInstance, position: Position = Position(0f), rotation: Quaternion = Quaternion(), scale: Scale = Scale(1f), pivot: Position = Position(0f), radius: Float = 0.5f, height: Float = 1.0f, segments: Int = 32, onCreate: (Entity) -> Unit = {})

A right circular cylinder aligned with the Y axis, centered on the origin (top at +height/2, bottom at -height/2). Side wall + two end caps. segments controls the radial subdivision.

The side wall and the caps use separate vertices (different normals), so this mesh has 4 * (segments + 1) vertices and 4 * segments triangles.

Parameters

material

Material applied to side and caps.

position

World-space position of the pivot point.

rotation

World-space rotation.

scale

Per-axis scale.

pivot

Point in mesh space that rotation/scale revolve around. Defaults to the cylinder centre.

radius

Cylinder radius in mesh space.

height

Full height along Y in mesh space.

segments

Number of radial subdivisions. Minimum 3.

onCreate

Receives the renderable entity ID once the cylinder is added to the scene.