Skip to content

ShapecastHit

Type

ShapecastHit describes one contact along a sweep from Physics.Spherecast, Physics.Boxcast, or Physics.Capsulecast.

Entity

Field
Entity: Entity?

Entity is the hit Entity, or nil if destroyed.

Position

Field
Position: Vector3

Position is the world-space contact point on the hit shape in units.

Normal

Field
Normal: Vector3

Normal is the outward unit normal at Position, or Vector3.new(0, 0, 0) when shapes start deeply overlapping.

Distance

Field
Distance: number

Distance is the distance in units along the sweep from from to contact (Fraction times the sweep length).

Material

Field
Material: string

Material is the name of the hit entity's material, or "" when the entity has no material or was destroyed.

LocalPosition

Field
LocalPosition: Vector3

LocalPosition is the contact point in the hit entity's own frame, or Position when Entity is nil. See RaycastHit.LocalPosition.

LocalNormal

Field
LocalNormal: Vector3

LocalNormal is the outward unit normal in the hit entity's own frame, or Normal when Entity is nil. See RaycastHit.LocalNormal.

Fraction

Field
Fraction: number

Fraction is the sweep progress from from (0) to to (1) at contact.