igargi Posted August 15, 2018 Share Posted August 15, 2018 Hi, I've a problem when exporting from 3DS max to .babylon. In the 3DS max the mesh and in the BabylonJS Sandbox is placed correctly, but when I open the exported with my code, that mesh is placed somewhere else. My code (It's in Angular 6, but with without Angular happens the same) if (BABYLON.Engine.isSupported()) { BABYLON.Engine.ShadersRepository = '/Babylon/Shaders/'; const canvas = this.el.nativeElement; const engine = new BABYLON.Engine(canvas, false); // Resize window.addEventListener('resize', function () { engine.resize(); }); // Scene, light and camera const scene = new BABYLON.Scene(engine); const light = new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene); const camera = new BABYLON.ArcRotateCamera('Camera', Math.PI / 2, Math.PI / 2, 50, new BABYLON.Vector3(0, 0, 0), scene); camera.attachControl(canvas); camera.inertia = 0.2; // Assets manager const assetsManager = new BABYLON.AssetsManager(scene); const meshTask = assetsManager.addMeshTask('sceneTask', '', '', 'http://localhost/index.php'); // You can handle success and error on a per-task basis (onSuccess, onError) meshTask.onSuccess = function (task) { console.log('hello'); task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); for (let i = 0; i < task.loadedMeshes.length; i++){ task.loadedMeshes[i].isPickable = true; } }; // But you can also do it on the assets manager itself (onTaskSuccess, onTaskError) assetsManager.onTaskError = function (task) { console.log('error while loading ' + task.name); }; scene.onPointerDown = function (evt, pick) { if (pick.hit){ console.log(pick.pickedMesh.name); } }; assetsManager.onFinish = function (tasks) { scene.debugLayer.show(); engine.runRenderLoop(function () { scene.render(); }); }; // Can now change loading background color: engine.loadingUIBackgroundColor = '#03528f'; // Just call load to initiate the loading sequence assetsManager.load(); } The object in SandBox and 3DS max, where it is placed correctly: And the model opened with BabylonJs where the object is moved: Thanks for your time Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 15, 2018 Share Posted August 15, 2018 This looks really strange. Is it possible to share the file so that @noalak could have a look ? Quote Link to comment Share on other sites More sharing options...
igargi Posted August 15, 2018 Author Share Posted August 15, 2018 For sure, I attach the 3ds and the .babylon file. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 15, 2018 Share Posted August 15, 2018 Thanks this will help @noalak during his troubleshooting. Quote Link to comment Share on other sites More sharing options...
noalak Posted August 16, 2018 Share Posted August 16, 2018 Hi igargi, Have you tried to remove the following line ? Quote task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); Noalak Sebavan and igargi 1 1 Quote Link to comment Share on other sites More sharing options...
igargi Posted August 17, 2018 Author Share Posted August 17, 2018 16 hours ago, noalak said: Hi igargi, Have you tried to remove the following line ? Noalak Yep, you're right. I copied the code from Internet and I forgot that part. Thanks 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.