Sphere

fun FilamentSceneScope.Sphere(material: MaterialInstance?, position: Position = Position(0f), rotation: Rotation = Rotation.Identity, scale: Scale = Scale(1f), pivot: Position = Position(0f), radius: Float = 0.5f, rings: Int = 16, segments: Int = 32, visible: Boolean = true, castShadows: Boolean = true, receiveShadows: Boolean = true, onCreate: EntityScope.() -> Unit = {})

A UV sphere centered on the origin. rings is the latitudinal count (from pole to pole), segments is the longitudinal count. Higher counts → smoother sphere, more triangles (rings * segments * 2 triangles total).

Parameters

material

The material applied to the whole sphere, 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 sphere centre.

radius

Sphere radius in mesh space.

rings

Latitude subdivisions. Minimum 2.

segments

Longitude 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 sphere casts shadows onto other renderables. On by default.

receiveShadows

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

onCreate

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