<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ARKit",
  "identifier" : "/documentation/ARKit/ARCamera/projectionMatrix(viewRotationAngle:viewportSize:zNear:zFar:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ARKit"
    ],
    "preciseIdentifier" : "c:objc(cs)ARCamera(im)projectionMatrixForViewRotationAngle:viewportSize:zNear:zFar:"
  },
  "title" : "projectionMatrix(viewRotationAngle:viewportSize:zNear:zFar:)"
}
-->

# projectionMatrix(viewRotationAngle:viewportSize:zNear:zFar:)

Creates a projection matrix for the camera given rendering parameters.

```
func projectionMatrix(viewRotationAngle: CGFloat, viewportSize: CGSize, zNear: CGFloat, zFar: CGFloat) -> simd_float4x4
```

## Parameters

`viewRotationAngle`

View rotation angle in degrees.

`viewportSize`

Viewport size.

`zNear`

Near depth limit.

`zFar`

Far depth limit.

## Return Value

The projection matrix for the given parameters.

## Discussion

The projection matrix returned provides an aspect fill for the provided viewport size and view angle.
If zFar is set to 0, an infinite projection matrix will be returned.

The view angle, in degrees, is the clockwise rotation needed to keep the camera image level with the horizon
(`0` LandscapeRight, `90` Portrait, `180` LandscapeLeft, `270` PortraitUpsideDown). Obtain it from
`ARSession.viewRotationAngle`.

---

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)