# MeshBuilder.CreateDecal stopped working after upgrading to v6.8.0 (Instanced mesh?)

**URL:** <https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-upgrading-to-v6-8-0-instanced-mesh/41665>\
**Category:** Bugs\
**Created:** [June 16, 2023, 2:58pm UTC](https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-upgrading-to-v6-8-0-instanced-mesh/41665 "2023-06-16T14:58:29Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [June 16, 2023, 2:58pm UTC](https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-upgrading-to-v6-8-0-instanced-mesh/41665/1 "2023-06-16T14:58:30Z")

</div>

Hi everyone,

I think I upgraded from v6.3.0 (or so). Here is the code - which should not be doing anything out of the ordinary:

```javascript
//FYI: all parameters console.logged; have expected type! 2nd parameter is a mesh; other params are Vector3s.
const decal = BABYLON.MeshBuilder.CreateDecal("decal", result.targets[i], {
  position: result.pickInfos[i].pickedPoint, 
  normal: result.pickInfos[i].getNormal(true), 
  size: this.effect.decalSize
 });             
break;

```

Unfortunately, I can only give you this error message since I have not figured out yet how to obtain a maxified version of Babylon:

```auto
Babylon.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'matrixData')
    at Object.ph [as CreateDecal] (Babylon.min.js:1:2001885)
    at DecalGroundBlootSplatPlayer.play (DecalGroundBlootSplat.js:86:51)
	(...)		

```

I cannot replicate the exact same error in the playground. But if you try to apply the decal on an InstancedMesh rather than a normal one it fails as well: [https://playground.babylonjs.com/#1BAPRM#1346](https://playground.babylonjs.com/#1BAPRM#1346)

Also note here: [https://playground.babylonjs.com/#1BAPRM#1347](https://playground.babylonjs.com/#1BAPRM#1347). You cannot add a decal to the parent mesh anymore (on the right).

Best wishes  
Joe

---

<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:** [June 16, 2023, 3:45pm UTC](https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-upgrading-to-v6-8-0-instanced-mesh/41665/2 "2023-06-16T15:45:16Z")

</div>

Thanks for reporting!

This PR will fix the crash:

> <https://github.com/BabylonJS/Babylon.js/pull/13976>
>
> See https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-…upgrading-to-v6-8-0-instanced-mesh/41665.

Regarding the 2nd problem, it’s because the `pick` predicate does not check for “catMother”:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BAPRM%231348)**
>
> 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:** [June 16, 2023, 6:00pm UTC](https://forum.babylonjs.com/t/meshbuilder-createdecal-stopped-working-after-upgrading-to-v6-8-0-instanced-mesh/41665/3 "2023-06-16T18:00:59Z")

</div>

> [@Evgeni\_Popov](#):
>
> Regarding the 2nd problem, it’s because the `pick` predicate does not check for “catMother”:

Ugh, sorry. Totally did not see the predicate function.
