Use Linear Algebra to solve problems in Unity with C#

Introduction

Math is fun, especially if you can use the math to solve problems you have. In this tutorial you will learn how to use Linear Algebra to solve problems in Unity. You will learn how to solve the following problems:

  1. How to figure out if an enemy is in front or behind you?

  2. If you are following a series of waypoints how do you know if you have passed a waypoint?

  3. If you are steering towards a waypoint, how do you determine if you should steer left or right?

  4. How can you find the coordinate where a ray intersects with a plane?

  5. How can you tell if two line segments in 2D space intersect?

  6. Are two triangles in 2D space intersecting?

  7. Are two rectangles with orientation in 2D space intersecting?