Jump to content

Import camera & light with ImportMesh method


Recommended Posts

Hi everyone,


In my project, I use one Preloader (Thanks to Temechon ;)) to load geometry I need. So I use the importMesh method to import my different meshes.

But, unless I am mistaken in the importMesh method the parsedLights and parsedCameras is never called.


However ,in one of my models, I model 2 spot lights, and with the importMesh is never imported.


Is it possible to manage the import lights with importMesh method? If not why?





Link to comment
Share on other sites

Today, we have 2 ways to import: only a mesh (the geometry with no light and no camera but the materials associated to it) and the loadScene to load everything: cameras, lights, meshes, animations and so on.

The importMesh has been designed to inject a mesh with its materials into an existing scene with its own camera & lightning.

In conclusion, you need to rather create your camera and lights by code or use the loadScene instead of importMesh.


Link to comment
Share on other sites

I think he can use the SceneLoader.Append() method of the scene loader. This way he enjoys both worlds - he has his already created scene but can still import an entire scene to it, including light and camera (I am not sure what will happen with the active camera, it's worth a try!)

Link to comment
Share on other sites



First, I want to thank you for your answer.


Then, I understand the difference between the LoadScene (in charge to create a scene) and ImportMesh (add a mesh into an existing scene).

But, in my point of view, the loader alogithme should be the same, because some just need to load a scene, while the other manage objects with specific mesh and need to import mesh, will create an instance of their class (like me).


For instance: I have a rover with equipments including a camera and spots.


However, thanks to @raananw, the append Method solve my problem ;)





Link to comment
Share on other sites

I am happy it helped.

The append function is rather new, i think a month or two ago someone suggest to implement it (here in the forum, you can try searching). It's rather new and (i believe) not yet documented. I guess that with version 2 the documentation will be a bit better. (@Deltakosh, @davrous und Co., if any help is needed with documentation, please let me know, I would be happy to start documenting classes and their functions, I think everyone will benefit)

Link to comment
Share on other sites



It is expected that there was a new official documentation, but we have no news about it. We wait patiently.

This probably will be when version 2.0 will be complete (I love version 2 has come with export Unity3d to Babylon :) ). but I think Deltakosh tell us more about this (new official documentation). 

GOOOOD NEWS!!!!!!!!!!! I found a way to pay for a better documentation directly integrated into babylonjs.com !
Expect more news soon!


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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...