PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

RaycastResult

RaycastResult

RaycastResult stores the result of a successful raycasting operation performed by WorldRoot/Raycast|WorldRoot:Raycast(). It contains the properties listed below.

This object should not be confused with the similarly-named datatype/RaycastParams which is used to perform a raycast.

Properties

number RaycastResult.Distance

The distance between the ray origin and the intersection point.

Instance RaycastResult.Instance

The BasePart or Terrain cell that the ray intersected.

Material RaycastResult.Material

The enum/Material at the intersection point. For normal parts this is the BasePart/Material; for Terrain this can vary depending on terrain data.

Vector3 RaycastResult.Position

The world space point at which the intersection occurred, usually a point directly on the surface of the instance.

Vector3 RaycastResult.Normal

The normal vector of the intersected face.