logo
By Lawrence

5 minutes

Grab the Hole

Moving the hole means editing the JSON and reloading. We want to pick it up with the mouse and slide it, in either view.

A ray, a plane, a box

The pointer is a ray from the camera through the cursor. A press near the hole grabs it. Each frame after that, the ray meets a plane through the hole that faces the camera, and the hole goes there, kept inside a box. In the top view that plane is y = 0, so x and z move. In the side view, with the hole where the scene puts it, the plane is z = −14, so x and y move. Held over the window's top-left corner:

top view     plane point [-46.96, 0, -26.41]     clamped to [-33, 0, -14]
side view    plane point [-54.66, 30.75, -14]    clamped to [-33, 14, -14]

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search