---
title: "init(origin:direction:)"
framework: spatial
role: symbol
role_heading: Initializer
path: "spatial/ray3d/init(origin:direction:)-63yk4"
---

# init(origin:direction:)

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

## Declaration

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

## Parameters

- `origin`: The origin of the ray.
- `direction`: The direction of the ray.

## Discussion

Discussion note: This function normalizes the direction vector.
