<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Spatial",
  "identifier" : "/documentation/Spatial/Ray3D/init(origin:direction:)-63yk4",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Spatial"
    ],
    "preciseIdentifier" : "s:So7SPRay3Da7SpatialE6origin9directionABSo9SPPoint3Da_So10SPVector3Datcfc"
  },
  "title" : "init(origin:direction:)"
}
-->

# init(origin:direction:)

Creates a ray from Spatial primitives that describe the origin and direction.

```
init(origin: Point3D = .zero, direction: Vector3D)
```

## Parameters

`origin`

The origin of the ray.

`direction`

The direction of the ray.

## Discussion> note: This function normalizes the direction vector.

---

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)