ShapecastHit
what a swept shape hit, and how far along the sweep it struck
Fields
4 members
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