tetley_tea Posted December 7, 2017 Share Posted December 7, 2017 Hi, I'm trying to use Angular 2 to create a BabylonJS scene - but seem to having some difficulty getting the OBJ loader to bring in the OBJ model. I'm getting this error: Unable to import meshes from http://localhost.cdn.com/b_azir.obj: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse. http://localhost.cdn.com is just an IIS website that points to a localhost website that contains the model files. (OBJ, MTL and textures). I can navigate to http://localhost.cdn.com/b_azir.obj fine. So that's no issue. I can include the code if one wishes. I would create a playground. But does it support TS? Thanks, Pete. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 7, 2017 Share Posted December 7, 2017 Hello I think this is because you forgot to load the obj loader? Quote Link to comment Share on other sites More sharing options...
tetley_tea Posted December 7, 2017 Author Share Posted December 7, 2017 Just now, Deltakosh said: Hello I think this is because you forgot to load the obj loader? Hey Deltakosh! I have imported the babylonjs library in my TypeScript file . As such: import * as BABYLON from 'babylonjs'; I have also imported the babylonjs and babylonjs-loaders types in my tsconfig.json file. { "compilerOptions": { "module": "es2015", "moduleResolution": "node", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "skipDefaultLibCheck": true, "skipLibCheck": true, // Workaround for https://github.com/angular/angular/issues/17863. Remove this if you upgrade to a fixed version of Angular. "strict": true, "lib": [ "es6", "dom" ], "types": [ "babylonjs", "babylonjs-loaders", "webpack-env" ] }, "exclude": [ "bin", "node_modules" ], "atom": { "rewriteTsconfig": false } } Am I missing something? I installed babylonjs locally using NPM: npm install babylonjs babylonjs-loaders --save-dev Thanks, Pete. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted December 7, 2017 Share Posted December 7, 2017 you still need to import it for side-effects (.OBJ registration): import 'babylonjs-loaders'; tetley_tea 1 Quote Link to comment Share on other sites More sharing options...
tetley_tea Posted December 7, 2017 Author Share Posted December 7, 2017 3 minutes ago, brianzinn said: you still need to import it for side-effects (.OBJ registration): import 'babylonjs-loaders'; +1 That worked! Thank-you! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 8, 2017 Share Posted December 8, 2017 Here we are Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.