Luduvo Contents
Theme
On this page

RaycastResult

what a ray hit: the entity, the point, the surface normal, and the distance

Fields

4 members

Distance: number

distance from the ray origin to the hit position

Entity: Instance?

entity hit by the ray, or nil if none

Normal: vector

surface normal vector at the hit position

Position: vector

hit position in world space

Reading What a Ray Hit

Lifecycle: Shared

A ray that reaches its maximum distance without touching a collider returns nil instead of a result.

Luau
local hit = game.Physics.Raycast(Vector3.new(0, 10, 0), Vector3.new(0, -1, 0), 50)if hit then	print(string.format("Floor %.1f studs down, slope %.2f", hit.Distance, hit.Normal.y))	local target = hit.Entity	if target then		print("Resting on:", target.Name)	endend