Jump to content

Obj babylon models need more understanding


chicagobob123
 Share

Recommended Posts

 I am not clear. Are models always loaded directly to the scene? Can I get the models mesh and use it like a primitive?

I want to apply the mesh to particles or take the geometry and apply different textures to it that are different colors. In my case, swapping textures to a container to indicate different vendors. 

The babylon format seems to include an entire scene from blender when all I want is the model. Am I understanding that correctly?

Thanks

 

Link to comment
Share on other sites

Hi @chicagobob123

you are mostlikely using the scene importer, while you should be using the mesh importer :)

if your file is a .babylon, see below code. assetName can be empty.

//Variable('s)
var container;

//Import
BABYLON.SceneLoader.ImportMesh("assetNameIfAny", "assetsFolder/", "myContainer.babylon", scene, function (newMeshes)
 {  
   //Assuming your container is the first(or only) mesh/object in the file.
   container = newMeshes[0];
   container.isVisible = false;
 });

//continue with instancing or copying & applying texture if it isn't already,

//remember setting yourCopiedOrInstancedMesh.isVisible = true; or if you choose to use the original imported mesh in your scene aswell, you can remove the isVisible completely.

 

Link to comment
Share on other sites

Bob, if you only want to import a specific mesh what @aWeirdo describes above is one way to do it.

Other ways would be:

1. To delete lights, cameras etc and to export from Blender only the mesh you want. This will give you a couple of warnings in the log file telling you you don't have a  light or camera - but the file will work.

2. To move lights and cameras etc to another layer. Then export only the layer with your mesh in it. Same warning as 1.

Then you can use the method outlined by @JCPalmerin this thread

cheers, gryff :)

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