One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

OrthographicCameraComponent

struct · iOS 18.0+ · SDK 27.1

struct OrthographicCameraComponent

A component that defines an orthographic virtual camera and its settings. Each scene requires a camera that defines the viewpoint from which RealityKit renders the scene. The orthographic camera renders the entities in the scene without the perspective of depth, meaning faraway objects don't look smaller. To create an orthographic camera, add this component to an entity. | **Perspective camera** | **Orthographic camera** | |:-:|:-:| | ![An illustration of three cubes, one behind the other, rendered with a perspective camera. The cube farthest away appears smaller than the closest one.](orthocamera-perspective-cubes) | ![A screenshot of three cubes, one behind the other, rendered with a orthographic camera. The cubes appear the same size, regardless of their distance.](orthocamera-orthographic-cubes) | You can add an `OrthographicCameraComponent` to an entity's component set, and orient that entity so that it looks at a specific target using ``Entity/look(at:from:upVector:relativeTo:)``. ```swift // Create an entity to hold the camera component. let cameraEntity = Entity() // Create an orthographic camera component and add it to the camera entity. cameraEntity.components.set(OrthographicCameraComponent()) // Set the entity's position and orientation to look at the subject. let cameraPosition: SIMD3<Float> = [0, 1, 3] // The subject in this case is the origin. let target: SIMD3<Float> = .zero cameraEntity.look(at: target, from: cameraPosition, relativeTo: nil) // Add the camera entity to your scene. content.add(cameraEntity) ``` In AR scenarios, the system provides the camera automatically; however, in non-AR scenarios, the app needs to set the camera. If the app doesn't provide a camera, the system uses the default perspective camera.

Members (9)

get · iOS 18.0+

scaleDirection

TypeScript
get scaleDirection(): CameraFieldOfViewOrientation
Swift declaration
var scaleDirection: CameraFieldOfViewOrientation

The direction in which the camera applies scaling.

set · iOS 18.0+

scaleDirection

TypeScript
set scaleDirection(value: CameraFieldOfViewOrientation)
Swift declaration
var scaleDirection: CameraFieldOfViewOrientation

The direction in which the camera applies scaling.

get · iOS 18.0+

far

TypeScript
get far(): number
Swift declaration
var far: Float

The maximum distance in meters from the camera that the camera can see. The value defaults to `1000.0`. Use a value greater than the value of ``near``. The renderer clips any surface beyond the `far` point.

set · iOS 18.0+

far

TypeScript
set far(value: number)
Swift declaration
var far: Float

The maximum distance in meters from the camera that the camera can see. The value defaults to `1000.0`. Use a value greater than the value of ``near``. The renderer clips any surface beyond the `far` point.

get · iOS 18.0+

near

TypeScript
get near(): number
Swift declaration
var near: Float

The minimum distance in meters from the camera that the camera can see. The value defaults to `1.0` centimeter. Use a value greater than `0.0` and less than the value of ``far``. The renderer clips any surface closer than the `near` point.

set · iOS 18.0+

near

TypeScript
set near(value: number)
Swift declaration
var near: Float

The minimum distance in meters from the camera that the camera can see. The value defaults to `1.0` centimeter. Use a value greater than `0.0` and less than the value of ``far``. The renderer clips any surface closer than the `near` point.

get · iOS 18.0+

scale

TypeScript
get scale(): number
Swift declaration
var scale: Float

A floating-point value the camera uses to scale entities.

set · iOS 18.0+

scale

TypeScript
set scale(value: number)
Swift declaration
var scale: Float

A floating-point value the camera uses to scale entities.

init · iOS 18.0+

init

TypeScript
static init(): OrthographicCameraComponent
Swift declaration
init()

Creates an orthographic camera component with default values.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →