Capítulo 826 de 859
Loading a glTF file is much simpler than an .OBJ file — materials and scene hierarchy come built into the format — but real assets can still need fixes for animation origins and camera framing, illustrated with a low-poly city model with driveable cars.
GLTFLoader: loads a .gltf/.glb file and yields a gltf.scene ready to add directly to the scene.Object3D and adjusting the original object's local offset so the wrapper's transform behaves correctly.CatmullRomCurve3 for paths: fits a smooth curve through a set of control points; adding extra points 10%/90% of the way between original points sharpens corners that would otherwise be rounded off.const points = curve.getPoints(250);
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({ color: 0xff0000 });
const curveObject = new THREE.Line(geometry, material);
scene.add(curveObject);
CatmullRomCurve3 into points and visualizing it as a Line, useful for previewing a path before driving objects along it.Object3D and offset the original locally rather than fighting its baked-in origin.CatmullRomCurve3 smooths through control points by default; inject extra near-corner points if you need sharper turns in a generated path.