R3f Decal cannot read properties of undefined (reading 'getX')

I add Decal to scene in one of meshes and pause render, getting error:
TypeError: Cannot read properties of undefined (reading 'getX') at _Vector3.fromBufferAttribute (three.module.js:4570:22) at generate (DecalGeometry.js:83:18) at new DecalGeometry (DecalGeometry.js:43:5) at Decal.js:67:25

The code:

<mesh
  name="poster2"
  castShadow
  receiveShadow
  geometry={nodes.poster2.geometry}
>
  <meshStandardMaterial transparent opacity={0.9} />
  <meshBasicMaterial />
  <Decal
    debug // Makes "bounding box" of the decal visible
    position={[0, 0, 0]} // Position of the decal
    rotation={[0, 0, 0]} // Rotation of the decal (can be a vector or a degree in radians)
    scale={0.1} // Scale of the decal
  >
    <meshBasicMaterial
      map={picture}
      polygonOffset
      polygonOffsetFactor={-1} // The material should take precedence over the original
    />
  </Decal>
</mesh>

I also tried default syntax of decal from drei documentation, but I got the same error.

<Decal
            meshStandardMaterial={pictureTextureMaterial}

?where do you have that from? there is no such property.

docs: GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber

1 Like