Jump to content

ImportMesh wireframe mode


Dad72
 Share

Recommended Posts

It does not work.

I fact:

BABYLON.SceneLoader.ImportMesh(Name, CheminModeles, Fichier, scene, function (newMeshes, particleSystems, skeletons){                        if(newMeshes[0]) {                                                        modele = newMeshes[0];                                  var myNewMaterial = new BABYLON.StandardMaterial("wireframe", scene);                            myNewMaterial.wireframe = true;                            modele.material = myNewMaterial;                            scene.activeCamera.attachControl(container);                }});

The model has always its textures by default to display.

 

 

Link to comment
Share on other sites

In the console i have constantly:

 
UnknownError  (5 error babylon.js (ligne 20))
...terialsIds .push(subMatId);parseMaterialById(subMatId,parseData,scene,rootURL);}...

 

 

 

More code

function init(CheminModeles, Fichier, Name) {                    var engine = new BABYLON.Engine(container, true);                scene = new BABYLON.Scene(engine);                                    BABYLON.SceneLoader.ImportMesh(Name, CheminModeles, Fichier, scene, function (newMeshes, particleSystems, skeletons)                {                                if(newMeshes[0]) {                                                        modele = newMeshes[0];                                                    modele.rotation.y = 0;                            modele.position = new BABYLON.Vector3(0, 0, 0);                            var myNewMaterial = new BABYLON.StandardMaterial("wireframe", scene);                                                        myNewMaterial.wireframe = true;                                                        modele.material = myNewMaterial;                                                        scene.activeCamera.attachControl(container);                        }                                                                                    });                                camera = new BABYLON.ArcRotateCamera("Camera", 1.52, 1.52, 150, new BABYLON.Vector3(0, 35, 0), scene);                                light = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 1, 0), scene);                light.diffuse = new BABYLON.Color3(1, 1, 1);                light.specular = new BABYLON.Color3(1, 1, 1);                light.groundColor = new BABYLON.Color3(0, 0, 0);                                engine.runRenderLoop(function ()                {                        scene.render();                                    });               }
Link to comment
Share on other sites

This code should work correctly. I just tested it quickly and everything is correct for me.

 

The function Importmesh import the mesh called "Name" and all its submeshes. Are you sure the material is updated on the correct mesh and not one of its children ? You can display the updated mesh name to be sure (console.log(modele.id)) in your callback function.

Link to comment
Share on other sites

In console.log (modele.id)

 

return:

a67642f6-d8e2-405c-ac73-deab1df21da5

 

 

I used the models 'Dude' of samples project and I rename the file name by him.Babylon

for the 'name' of the function init(), i retrieves the name of the file.

 

I have not understood this:

Are you sure the material is updated on the correct mesh and not one of its children ?

 

 

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...