Command Palette

Search for a command to run...

Hectal
Phase 8: Interaction
3D Web · Exercise 4 of 4 Previous
Intermediate

Pin a label to a 3D point

placeLabel(point) must put #tag on top of a 3D point: project the point, convert to pixels (y flips), set style.left and style.top in px and show it.

If the point is behind the camera, off the screen or beyond the far plane, hide the tag with style.display = "none". The starter always puts it at the top-left.

What Check tests

  1. The point (1, 0, 0) is labelled at the right pixel
  2. A point behind the camera hides the tag
  3. A point far off to the right hides the tag

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.