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

# ProjectiveTransformCameraComponent

A component that defines a virtual camera with a custom projection matrix.

```
struct ProjectiveTransformCameraComponent
```

## Overview

Each scene requires a camera, which defines the viewpoint from which RealityKit renders the scene. The projective transform camera
renders the entities in the scene based on a custom user defined matrix.
For this component, define a matrix that is either of symmetric perspective or orthographic projection.
Define symmetric perspective matrices using reverse depth i.e., a matrix with near and far reversed.
To create a projective transform camera, add this component to an entity.

```swift
// Create a projective transform camera component with a custom matrix.
let projectiveTransform = ProjectiveTransform3DFloat(
    fovY: Angle2DFloat(degrees: 90.0),
    aspectRatio: 0.6,
    nearZ: 0.01,
    farZ: 1000.0,
    reverseZ: true)
var projectiveCameraComponent = ProjectiveTransformCameraComponent(projectionMatrix: projectiveTransform.matrix)

// Create an entity with the camera component.
let cameraEntity = Entity(components: projectiveCameraComponent)

// Set the entity's position and orientation to look at the subject (the origin in this case).
let cameraPosition: SIMD3<Float> = [0, 1, 3]
let target: SIMD3<Float> = .zero
cameraEntity.look(at: target, from: cameraPosition, relativeTo: nil)

// Add the camera entity to your scene.
content.add(cameraEntity)
```

## Topics

### Initializers

[`init(projectionMatrix: float4x4)`](/documentation/RealityKit/ProjectiveTransformCameraComponent/init(projectionMatrix:))

Creates a new custom matrix camera component with the given settings.

### Instance Properties

[`var transform: float4x4`](/documentation/RealityKit/ProjectiveTransformCameraComponent/transform)

The custom projection RealityKit applies to objects in the scene.

## Relationships

### Conforms To

[`Component`](/documentation/RealityKit/Component)

[`Equatable`](/documentation/Swift/Equatable)

---

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)