Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use GLTFLoader #210

Open
hohaidang2000 opened this issue Oct 13, 2020 · 2 comments
Open

can't use GLTFLoader #210

hohaidang2000 opened this issue Oct 13, 2020 · 2 comments

Comments

@hohaidang2000
Copy link

here is my import
import { BoxGeometry, MeshBasicMaterial, Mesh, BoxHelper,GLTFLoader} from 'three';
here is the part that i add in render 3d:
let loader = new GLTFLoader();

loader.load(
  'models/out.glb', function (gltf) {


    let model = gltf.scene;
  }, undefined, function (error) {

    console.error(error);

  });

it broke down when i try 3d view even when i don't load the model in Promise.resolve(mesh);
it only works after i delete the above codes. So is there any alternative way to import 3d model?

@hohaidang2000
Copy link
Author

oh this line above too:
let loader = new GLTFLoader();

@512081216
Copy link

512081216 commented Feb 20, 2021

hi, you can upgrade three to "0.123.0" first, then use GLTFLoader like this in load-obj.js

`
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';

export function loadGlftObj(filePath) {
const loader = new GLTFLoader();
return new Promise((resolve, reject) => {
loader.load(filePath, function ( gltf ) {
resolve(gltf.scene)
}, undefined, function ( e ) {
console.error( e );
} );
});
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants