RaycastResult
what a ray hit: the entity, the point, the surface normal, and the distance
Fields
4 members
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