How to move meshes from imported obj file?

I am pretty new to babylon and web graphics but I think it is the right tool for what I want to do. I have managed to import obj file into babylon but I can’t manage to access/modify the meshes from this file individually?

I have tried to access them by scene.getMeshByName and byID and UniqueID (got from sandbox)

I have also tried to convert the obj into a .babylon file but the Blender plugin fails with an error hence why I am dealing with obj files.

Traceback (most recent call last):
File "...\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\", 
line 65, in execute
exporter.execute(context, self.filepath)
File "...\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\", line 115, in execute
mesh = Mesh(object, scene, self)
File "...\Blender\2.83\scripts\addons\babylon_js\", line 158, in __init__
File "...\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\", line 79, in processImageTextures
tex.process(self.exporter, True, bpyMesh)
File "...\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\materials\", line 84, in process
self.uvMapName =
AttributeError: 'NoneType' object has no attribute 'name'

location: <unknown location>:-1

Here is my obj file Gofile

Hello and welcome :wink:

can you repro your issue in the Playground?

I think it explains what I’m trying to do

Hey @loscar9 !

It seems that the “StanfordBunny.obj” in your example does not contain multiple meshes!
So you won’t be able to move the “ears” mesh, because there is no separation in it.

You can check the scene via the inspector. Just click on the options-icon in the playground (top right) and click on “inspector”. You can then check the nodes of the scene.

I may suggest you to replicate your example with the “candle.babylon” file. This one has multiple meshes in it.

My .obj (linked first post) has multiple nodes in it, so how do I access them individually via getMeshBy_? I will try with candle like you suggested when I get back to my desk

Would help?


Well I took some time and tested a PlayGround with the file you provided.
Btw you can easily use external assets via DropBox (if you have an account there).

Check this:

I used the BABYLON.SceneLoader.ImportMesh-Method. like this:

        function (meshes) {          
            scene.createDefaultCameraOrLight(true, true, true);

             //log the name of the meshes we just imported
            for(var i = 0; i < meshes.length; i++){

           var wallsMesh = scene.getMeshByID("walls");
           wallsMesh.isVisible = false;

I deleted the website.obj, so the example won’t work with my link anymore…so feel free to host it yourself or try it in your local dev-environment!

I think your problem was not the scene.getMeshByID()-method. I guess you placed the call in the wrong place?! You have to make sure that everything is loaded before accessing the mesh (e.g. via the onSucess?-callback function in the ImportMesh()-method).


It works! Thank you, if i create a variable for a certain mesh from this, can I access it from anywhere and it will update the mesh?

You are welcome :slightly_smiling_face:
If you want to use the variable from anywhere, then declare it outside of the onSucess-function!
Otherwise the scope will be only in the function!

Check this:

So I would declare a variable outside and assign it in the function! So you can use it anywhere :face_with_monocle:

Have you solved Blender export babylon file error ? I met the same situation