Game dev
Saved & recent

Raycast

Also called: line trace

Related terms: hitscan

Shoots an invisible line from a point in a direction and asks the physics engine what it hits first. The answer includes the object, the hit point, the distance and the surface normal there.

Used for instant-hit weapons, checking if the player is on the ground, line of sight for AI, and picking objects with the mouse.

Further reading
Godot: RayCast3D
hit distance origin first hit surface normal
The ray returns the first wall it reaches, the distance to the intersection and the blue surface normal at that point.

View in the full Game dev collection