# Mesh picking on simplified mesh picks the wrong mesh

**URL:** <https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170>\
**Category:** Questions\
**Tags:** lod, gltf, glb, picking\
**Created:** [February 20, 2024, 7:19pm UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170 "2024-02-20T19:19:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FearsomeFlyingJacob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fearsomeflyingjacob/32/36359_2.png) [@FearsomeFlyingJacob](https://forum.babylonjs.com/u/FearsomeFlyingJacob)\
**Post date:** [February 20, 2024, 7:19pm UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/1 "2024-02-20T19:19:42Z")

</div>

I’m trying to add interaction to an application where I have various complex mesh trees. The actual “entities” in my application are these mesh trees, all of which have a `TransformNode`  
as a root, in which I stored a custom property with information about the entity itself.

When clicking on any mesh that is part of the entity, I want to traverse the tree back up to the root `TransformNode` for that entity, where then I can access the custom information to display it in the application.

The problem arises when using Auto-LOD with my imported GLTF models. The interaction picks the decimated models instead of the normal meshes, and those decimated models _do not_ have the same root as the original ones, so I cannot traverse parent links to find my stored custom information.

The following playground shows the issue. At the top I added a flag do disable simplification, to show that without it it works.

> **[Babylon.js Playground](https://playground.babylonjs.com/#WGZLGJ%239946)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

It could be that there’s a bug with simplification of imported GLTF models, as I’ve seen that with another mesh (a `.babylon` file) my example works correctly:

> **[Babylon.js Playground](https://playground.babylonjs.com/#2JBSNA%23261)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [February 21, 2024, 8:57am UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/2 "2024-02-21T08:57:54Z")

</div>

You could disable picking for the LODs: [https://playground.babylonjs.com/#WGZLGJ#9949](https://playground.babylonjs.com/#WGZLGJ#9949)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 21, 2024, 9:39am UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/3 "2024-02-21T09:39:09Z")

</div>

The problem may be that meshes from glTF files are right handed.

See this answer (the `overrideMaterialSideOrientation` part):

> [@Why are the simplified mesh surface normals all flipped](https://forum.babylonjs.com/t/why-are-the-simplified-mesh-surface-normals-all-flipped/38737/3):
>
> [The doc about mesh simplification](https://doc.babylonjs.com/features/featuresDeepDive/mesh/simplifyingMeshes#mesh-optimization-starting-with-babylonjs-21) is saying that artefacts with uv mapping can occur when using optimizeIndices. In that case, it suggests to use the optimizeMesh option instead. Also, as meshes are coming from a .gltf/glb file, the mesh.overrideMaterialSideOrientation property should be copied over the simplified meshes. Here’s a fixed PG:

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 21, 2024, 9:43am UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/4 "2024-02-21T09:43:44Z")

</div>

It seems I misread your post! I think the solution from @Joe_Kerr is the right one.

---

<div class="post-metadata">

**Author:** ![FearsomeFlyingJacob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fearsomeflyingjacob/32/36359_2.png) [@FearsomeFlyingJacob](https://forum.babylonjs.com/u/FearsomeFlyingJacob)\
**Post date:** [February 21, 2024, 9:46am UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/5 "2024-02-21T09:46:59Z")

</div>

Thank you! This solved the issue.

---

<div class="post-metadata">

**Author:** ![FearsomeFlyingJacob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fearsomeflyingjacob/32/36359_2.png) [@FearsomeFlyingJacob](https://forum.babylonjs.com/u/FearsomeFlyingJacob)\
**Post date:** [February 21, 2024, 9:47am UTC](https://forum.babylonjs.com/t/mesh-picking-on-simplified-mesh-picks-the-wrong-mesh/48170/6 "2024-02-21T09:47:55Z")

</div>

This was another issue, it caused the normals of the LODs to be inverted, and I was already doing that
