Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 10.3 — Loading Models
3D Web · Example 1 of 2

Load, measure, scale and stand on the floor

The bike is already in metres; the fox is not. Both end with their lowest point on the floor. Fox model by PixelMannen (CC0), rigging and animation by tomkranis (CC BY 4.0), glTF conversion by @AsoboStudio and @scurest (CC BY 4.0); the licences are the subject of Topic 10.6.

GLTFLoader.loadAsync(url) fetches and parses a model and gives you its scene. Then you measure it, scale it to real size, stand it on the floor, and handle the ways a load fails: a missing file, a file that is not a model, no network.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write fitToLength(object, metres) that scales an object so its longest side has that length and puts its lowest point at y = 0.

02

Load the Fox and print the names of its animation clips and its node count.

Explain it without notes

01

A model loads but nothing appears. Name three things you would check, in order.

02

What does SyntaxError: Unexpected token '<' usually mean when loading a .glb, and how do you confirm it?

Load, measure, scale and stand on the floor
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

bike  as loaded: 1.83 x 0.92 x 0.56 | scale x0.9978 | lowest point now 0.000
fox   as loaded: 25.19 x 79.03 x 154.72 | scale x0.0058 | lowest point now 0.000