Luduvo Contents
Theme
On this page

ShapecastHit

what a swept shape hit, and how far along the sweep it struck

Fields

4 members

Entity: Instance

entity hit by the swept shape

Fraction: number

fraction along the sweep path where the collision occurred

Normal: vector

surface normal vector at the contact point

Point: vector

contact point in world space

Sweeping a Box Along a Path

Lifecycle: Shared

Fraction runs from 0 at the start of the sweep to 1 at its destination, so the smallest fraction is the first contact.

Luau
-- The size of a swept box is its half extentslocal halfExtents = Vector3.new(1, 1, 1)local from = Vector3.new(0, 6, 0)local to = Vector3.new(0, 0, 0)local count, hits = game.Physics.Shapecast("Box", halfExtents, from, to)for i = 1, count do	local hit = hits[i]	print(string.format("%s at %.2f of the sweep", hit.Entity.Name, hit.Fraction))end