Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
RaycastResult
The RaycastResult data type stores the result of a successful raycasting operation performed by WorldRoot:Raycast(). It contains the properties listed below.
This object should not be confused with the similarly-named RaycastParams which is used to perform a raycast.
Properties
| Name | Type / Returns | Description |
|---|---|---|
| RaycastResult.Distance | number | The distance between the ray origin and the intersection point. |
| RaycastResult.Instance | BasePart | The BasePart or Terrain cell that the ray intersected. |
| RaycastResult.Material | Material | The Material at the intersection point. |
| RaycastResult.Position | Vector3 | The world space point at which the intersection occurred. |
| RaycastResult.Normal | Vector3 | The normal vector of the intersected face. |
RaycastResult.Distance
The distance between the ray origin and the intersection point.
| Field | Value |
|---|---|
| type | number |
RaycastResult.Instance
The BasePart or Terrain cell that the ray intersected.
| Field | Value |
|---|---|
| type | BasePart |
RaycastResult.Material
The Material at the intersection point. For normal parts this is the BasePart.Material; for Terrain this can vary depending on terrain data.
| Field | Value |
|---|---|
| type | Material |
RaycastResult.Position
The world space point at which the intersection occurred, usually a point directly on the surface of the BasePart or Terrain cell.
| Field | Value |
|---|---|
| type | Vector3 |
RaycastResult.Normal
The normal vector of the intersected face.
| Field | Value |
|---|---|
| type | Vector3 |