Raycasting

Raycasting is how a Unity script asks the physics world a question: what is under the mouse, is there ground below the player, did this shot hit anything. A ray is a point and a direction, and Physics.Raycast tells you the first collider it touches along with where and how far. Almost every interaction system is built on it.

More in Physics & Math

  1. Vectors & Math
  2. Rotations & Quaternions
  3. Rigidbody, Colliders & Triggers
  4. Raycasting

All 42 topics in the Learn Unity Roadmap