Rays, Planes and Normals
While the player holds the drop button, Harbour Hopper shows a small target ring where the crate will land: on a deck, on the sloping boat ramp, or in the water. To place it, the game fires an invisible ray straight down from the drone and asks where it first meets a surface. Two dot products and one division answer that.
The rule
Signed distance to a plane: normal dot point, minus offset.
A ray is a start point plus a direction that can be stretched: with . When is a unit vector, is simply the distance travelled.
A plane — in our side view a line, in 3D a flat sheet — is described by a unit normal , the arrow sticking straight out of the surface, and an offset . The plane is every point with . The water is ; the deck is .
The signed distance of any point from the plane is . It is positive on the side the normal points to, zero on the plane and negative behind it. A crate at has against the water: it is 0.4 m under.
To hit a plane with a ray, put into the plane's rule and solve for :
If , the ray runs parallel to the plane and never crosses it. If , the plane is behind the ray's start.
The shortcut
Two dots and a divide. Compute and ; then = (offset − first dot) ÷ second dot. The first dot hands you the signed distance for free.
The boat ramp slopes down into the water along , so and . The drone is at and the ray points straight down, .
Normal dot start
0.6 × 4 + 0.8 × 9 = 2.4 + 7.2 = 9.6.
Notice that 4.5 m straight down is more than the 3.6 m signed distance: on a slope, "straight down" is not the shortest way to the surface.
The trap is a normal that isn't unit length. Use with instead of with and it's the same ramp, but every signed distance comes out five times too big.
Drills
Answer fast — trust the rule.
The water is n = (0, 1), d = 0. A crate sits at (7, −0.4). What does its signed distance say?
A ray gives n · u = 0. What does that mean?
A ray–plane test returns t = −3. What should the target ring do?
For the ramp 0.6x + 0.8y = 6, where is a gull at (10, 3)?
Remember
- A ray is o + t·u; a plane is every point with n · p = d, using a unit normal.
- Signed distance = n · p − d: positive in front, zero on, negative behind.
- Ray hit: t = (d − n · o) ÷ (n · u); a zero divisor means parallel, and a negative t means behind.
