Highlight + importmesh


I am trying to have an imported mesh highligthed on a “mouse over” event.

I’ve been able to have it work with simple created geometry but not with imported mesh.

Here is a working version of highlight/click and drag with simple geometry :


Here is the version working (with not working code in comment) :

Please change #55 to #54 to have the non-working version (new user cannot post more that 2 links…).

I receive the error “cannot read property ‘uniqueid’ of undefined”.

It seems I don’t understand how the context works.


Working! here is the final code :


Finally got it working, needed to add a few things :

var head = new BABYLON.Mesh(“name”,scene);

(my import was from sketchfab, meshes[0] didn’t work. I needed to use meshes[1]. I don’t understand the difference but one has .subMeshes and not the other)

Add a verification if the mesh was loaded before using it (highlighting it)

Thank you,

Hi. I think meshes[0] it’s root node. You can open model in Babylon inspector and look at hierarchy

1 Like