Group

fun FilamentSceneScope.Group(position: Position = Position(0f), rotation: Quaternion = Quaternion(), scale: Scale = Scale(1f), pivot: Position = Position(0f), onCreate: (Entity) -> Unit = {}, content: @Composable FilamentSceneScope.() -> Unit)

Groups child scene composables under a single transform. Everything declared inside content is parented to a hidden transform entity, so moving/rotating/scaling the Group moves the whole assembly as a unit. Children's own position/rotation/scale become local to the group, and groups themselves nest cleanly inside other groups.

Group(position = Position(2f, 0f, 0f), rotation = bodyRotation) {
Cube(material = body, size = 1.5f)
Cylinder(material = wheel, position = Position( 0.6f, -0.4f, 0f), radius = 0.2f, height = 0.1f)
Cylinder(material = wheel, position = Position(-0.6f, -0.4f, 0f), radius = 0.2f, height = 0.1f)
}

Note: a Light inside a Group is parented like any other child, so the group's translation moves it. But a light's direction comes from its direction parameter, not the transform, so rotating a Group does not rotate the light it contains.

Parameters

position

World-space position of the group's pivot (or local-space if this Group is itself nested inside another Group).

rotation

Rotation applied to the whole group.

scale

Scale applied to the whole group.

pivot

Mesh-space pivot point that rotation/scale revolve around.

onCreate

Receives the group's transform entity ID once it's created.