Contents

ModelEntity

A representation of a physical object that RealityKit renders and optionally simulates.

Declaration

@MainActor @preconcurrency class ModelEntity

Mentioned in

Overview

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.

[Image]

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 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.

Topics

Creating a model

See Also

Model display