Cylinder

fun FilamentSceneScope.Cylinder(material: MaterialInstance?, position: Position = Position(0f), rotation: Rotation = Rotation.Identity, scale: Scale = Scale(1f), pivot: Position = Position(0f), radius: Float = 0.5f, height: Float = 1.0f, segments: Int = 32, visible: Boolean = true, castShadows: Boolean = true, receiveShadows: Boolean = true, onCreate: EntityScope.() -> 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, or null while it is still loading.

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.

visible

Whether this renderable is in the scene. False removes it from the scene (cheaply, keeping the entity alive) — a show/hide toggle without losing state.

castShadows

Whether the cylinder casts shadows onto other renderables. On by default.

receiveShadows

Whether the cylinder receives shadows cast by others. On by default.

onCreate

Runs once when the cylinder enters the scene, with the renderable entity and engine in scope (EntityScope).