Jump to content

BabylonJS ImportMesh from STL and assign material


MarkGuk
 Share

Recommended Posts

Ok, so have wrecked my brain with this issue and looking for some help.

When using SeceneLoader.ImportMesh on a .STL I can only see 'grey' geometry coming in from the .STL file. The .STL file itself is attached to the forum issue.

Code as follows:

BABYLON.SceneLoader.ImportMesh("", "", "City.stl", scene, function (newMeshes) {
            city1 = newMeshes[0];
            city1.position=new BABYLON.Vector3(25,10,0);
            city1.scaling=new BABYLON.Vector3(10,10,10);
            c1mat = new BABYLON.StandardMaterial("c1mat", scene);
            city1.material = c1mat;
            c1mat.diffuseColor = new BABYLON.Color3(1,0.5,1);
            });

Although I get my mesh imported perfectly none of the other properties seem to carry through e.g. Position/SCaling/Colors.

Any help greatly appreciated.

City.stl

Link to comment
Share on other sites

Debug layer on confirms that my 'city' geometry from the STL file does indeed import as a single Mesh. So as it's a single mesh I'd assume that it would be position [0] in any newMeshes array? Still not getting any colors or properties carried through with the STL import.

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