Jump to content

Recommended Posts

Hi ,When I use the Babylon file, which is exported by the 3dsmax exporter, some of the time, my model will have all sorts of weird problems.

I list some problems, because of these features in 3 ds Max normal performance, Only in babylonjs will appear problem, Maybe I, informs it incorrectly, Only at some point will there be a problem, what is straightforward.

1.Some time, when I add parent to the mesh as a whole, the loaded model returns to the center of the scene.

  var groundMaterial = new BABYLON.StandardMaterial("groundMaterial", scene);
        groundMaterial.alpha = 0;

        var ground = BABYLON.Mesh.CreateGround("ground", 512, 512, 32, scene, false);
        ground.material = groundMaterial;

        for (var i = 0; i < scene.meshes.length; i++) {
            scene.meshes[i].position.y += 13;
            if (i < scene.meshes.length - 1) {
                scene.meshes[i].parent = ground;
            }
        }

        ground.scaling = new BABYLON.Vector3(0.1, 0.1, 0.1)
Before using
b2.thumb.jpg.580e851e87ee7b71a3a27b9068d8c4d3.jpg
After using
b1.jpg.8b621191da9ff30c49aacea3346c2768.jpg
Link to post
Share on other sites

Why do you need parenting meshes to the ground ?

I'm not quite sure, but I think this code

            scene.meshes[i].position.y += 13;

will reset all meshes Y position to 13, so of course all meshes will be moved, positioning their center pivot to Y=13 ; isn't it ?

 

[edit ] no i get it, it add 13 to the value, so as to be up to the ground i suppose [/edit]

Link to post
Share on other sites
22 hours ago, V!nc3r said:

Why do you need parenting meshes to the ground ?

I'm not quite sure, but I think this code


            scene.meshes[i].position.y += 13;

will reset all meshes Y position to 13, so of course all meshes will be moved, positioning their center pivot to Y=13 ; isn't it ?

 

[edit ] no i get it, it add 13 to the value, so as to be up to the ground i suppose [/edit]

I need to do a whole operation on all the mesh, like this:

Ground. Scaling = new BABYLON. Vector3 (0.1, 0.1, 0.1)

Rotation, scaling, position and so on

That's why I got the meshes to the ground.

Do you have a better way to do this?:P

Link to post
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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...