<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ModelComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14ModelComponentV"
  },
  "title" : "ModelComponent"
}
-->

# ModelComponent

A component that contains a mesh and materials for the visual appearance of an entity.

```
struct ModelComponent
```

## Overview

This component is a foundational component for all visual content in RealityKit.
Use `ModelComponent` to render 3D models by attaching it to any [`Entity`](/documentation/RealityKit/Entity)
in your RealityKit scene.

To create a `ModelComponent`, you need a mesh and the number of materials that mesh expects,
which is typically one.

For example, here’s how to create a simple blue, metallic box using
[`generateBox(size:cornerRadius:)`](/documentation/RealityKit/MeshResource/generateBox(size:cornerRadius:)-8em0v),
and [`SimpleMaterial`](/documentation/RealityKit/SimpleMaterial):

```swift
let mesh = MeshResource.generateBox(size: 1, cornerRadius: 0.05)
let material = SimpleMaterial(color: .blue, isMetallic: true)

let modelComponent = ModelComponent(mesh: mesh, materials: [material])

let entity = Entity()
entity.components.set(modelComponent)
```

![A screenshot of a reflective, metallic blue cube centered on the screen with a plain background.](images/com.apple.RealityKit/modelcomponent-cube-simple.jpg)

Make different primitive shapes, like spheres with
[`generateSphere(radius:)`](/documentation/RealityKit/MeshResource/generateSphere(radius:)),
or cylinders with [`generateCylinder(height:radius:)`](/documentation/RealityKit/MeshResource/generateCylinder(height:radius:)),
or create custom shapes with [`MeshDescriptor`](/documentation/RealityKit/MeshDescriptor).
For more information about materials, see [Applying realistic material and lighting effects to entities](/documentation/RealityKit/applying-realistic-material-and-lighting-effects-to-entities)

> Tip: To load a USDZ or reality file to your app, use an entity initializer such as
> ``doc://com.apple.RealityKit/documentation/RealityKit/Entity/init(named:in:)`` or ``doc://com.apple.RealityKit/documentation/RealityKit/Entity/init(contentsOf:withName:)``.

Use other components like
[`CollisionComponent`](/documentation/RealityKit/CollisionComponent), [`PhysicsBodyComponent`](/documentation/RealityKit/PhysicsBodyComponent),
[`PhysicsMotionComponent`](/documentation/RealityKit/PhysicsMotionComponent), and [`InputTargetComponent`](/documentation/RealityKit/InputTargetComponent)
to make entities interactive and dynamic.

## Topics

### Creating a model component

[`init(mesh:materials:)`](/documentation/RealityKit/ModelComponent/init(mesh:materials:))

Creates a model component from a mesh and a collection of materials.

### Configuring a mesh

[`mesh`](/documentation/RealityKit/ModelComponent/mesh)

The mesh that defines the model’s shape.

### Configuring the materials

[`materials`](/documentation/RealityKit/ModelComponent/materials)

The materials that define the model’s visual appearance.

### Modifying the bounding box for rendering

[`boundsMargin`](/documentation/RealityKit/ModelComponent/boundsMargin)

A margin applied to an entity’s bounding box that determines object
visibility.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)