The GLTF loader isn’t throwing any errors
When I try to render a mesh it works fine
I tried scaling and rotating the gltf scene but it doesn’t work
I’m out of ideas
Any other suggestions?
import * as three from "three";
import {GLTFLoader} from "three/addons/loaders/GLTFLoader.js";
// SCENE
const scene = new three.Scene();
const canvas = document.querySelector("#world");
const loader = new GLTFLoader();
const renderer = new three.WebGLRenderer({canvas});
const fov = 45;
const camera = new three.PerspectiveCamera(fov, 800/600);
camera.position.z = 20;
scene.add(camera);
loader.load( './models/test.gltf', function ( gltf ) {
gltf.scene.scale.set( 1000000, 1000000, 100000);
camera.lookAt(gltf.scene.position);
scene.add( gltf.scene );
}, undefined, function ( error ) {
console.error( error );
} );
const shape = new three.SphereGeometry(3, 64, 64);
const material = new three.MeshStandardMaterial({
color: "#ff0304"
});
const body = new three.Mesh(shape, material);
scene.add(body);
const light = new three.PointLight(0xffffff, 1, 100);
light.position.set(0, 10, 10);
scene.add(light);
renderer.setSize(window.innerWidth*0.5, window.innerHeight*0.8);
const render = function () {
renderer.render(scene, camera);
requestAnimationFrame(() => render());
};
render();
The code is all over the place, but I’m just trying to make it work