One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

ModelEntity

class · iOS 13.0+ · SDK 27.1

@MainActor @preconcurrency class ModelEntity

A representation of a physical object that RealityKit renders and optionally simulates. Use one or more model entities to place physical objects in a scene. In addition to the components they inherit from the ``Entity`` class, model entities have geometry, described by their ``ModelComponent``. Model entities acquire the model component by conforming to the ``HasModel`` protocol. You specify meshes and materials to control how a model entity appears. ![Diagram showing the components present in the model entity.](ModelEntity-1) Models respond to physics simulations because they conform to the ``HasPhysics`` protocol. You give them mass and other physical properties with a ``PhysicsBodyComponent`` instance, and then apply forces or impulses. The simulator uses a ``PhysicsMotionComponent`` to manage the linear and angular velocity of the object. Alternatively, you can selectively circumvent the simulation to control position and velocity yourself. Do this for a given model by setting its physics body ``PhysicsBodyComponent/mode`` to ``PhysicsBodyMode/kinematic``. Models can also collide with one another, and with other entities that conform to the ``HasCollision`` protocol. The ``CollisionComponent`` provides parameters that let you manage which models collide with each other. It also lets you control the collision shape, which for performance reasons, is typically simpler than the visual geometry.

Members (4)

init · iOS 13.0+

init

TypeScript
static initMeshMaterialsCollisionShapeMass(mesh: MeshResource, materials: Array<SDKHandle>, collisionShape: ShapeResource, mass: number): Promise<ModelEntity>
Swift declaration
@MainActor @preconcurrency init(mesh: MeshResource, materials: [any Material] = [], collisionShape: ShapeResource, mass: Float)

Creates a model entity with a particular mesh, set of materials, collision shape, and mass. - Parameters: - mesh: A mesh that defines the geometry of the model. - materials: Material resources that define the appearance of the model. - collisionShape: A collection of shape resources that define a composite collision shape. - mass: The mass of the model in kilograms.

init · iOS 13.0+

init

TypeScript
static initMeshMaterialsCollisionShapesMass(mesh: MeshResource, materials: Array<SDKHandle>, collisionShapes: Array<ShapeResource>, mass: number): Promise<ModelEntity>
Swift declaration
@MainActor @preconcurrency init(mesh: MeshResource, materials: [any Material] = [], collisionShapes: [ShapeResource], mass: Float)

Creates a model entity with a particular mesh, set of materials, a composite collision shape, and mass. - Parameters: - mesh: A mesh that defines the geometry of the model. - materials: Material resources that define the appearance of the model. - collisionShapes: A collection of shape resources that define a composite collision shape. - mass: The mass of the model in kilograms.

init · iOS 13.0+

init

TypeScript
static initMeshMaterials(mesh: MeshResource, materials?: Array<SDKHandle>): Promise<ModelEntity>
Swift declaration
@MainActor @preconcurrency init(mesh: MeshResource, materials: [any Material] = [])

Creates a model entity with a particular mesh and set of materials. - Parameters: - mesh: A mesh that defines the geometry of the model. - materials: Material resources that define the appearance of the model.

init · iOS 13.0+

init

TypeScript
static init(): Promise<ModelEntity>
Swift declaration
@MainActor @preconcurrency required init()

Creates a model entity.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →