Jump to content

Mesh moved when exporting in 3DS max


Recommended Posts

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:

image.thumb.png.c2959d0c5720ffad21f9e1c96d540a1b.pngimage.thumb.png.fa25c4b4cd490877e472d6d4a52ef4b2.png

 

And the model opened with BabylonJs where the object is moved:

 

image.thumb.png.9fd19be08d17f656499010193a061c45.png

 

Thanks for your time :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...