Keep getting ERROR TypeError: THREE.DecalGeometry is not a constructor

I am trying to paste a decale sticker on my mesh on click like the official example, but I keep getting this error on click ERROR TypeError: THREE.DecalGeometry is not a constructor.

This is the import: import { DecalGeometry } from ‘three/addons/geometries/DecalGeometry.js’;

I am so tired trying to find a solution to this problem please help.

try
new DecalGeometry(
instead of
new THREE.DecalGeometry(

Example,

1 Like

Lmao it worked, I swear to god this library is going to drive me crazy,

The clue is in how you import it,

import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js';
---------------^

If you don’t mind, Is this an issue of UV mapping ?, it’s supposed to be an angular A

I imported it the same way in the doc.

Re “UV mapping”, it is a known problem with the DecalGeometry. I am not aware of any solution.

Okay thanks !

Can you show which doc?

https://threejs.org/docs/#examples/en/geometries/DecalGeometry

“Phrase not found”

oh you are talking about the constructor !, to be honest I don’t remember I went back and forth between both of them since both versions were used online.

Now that I think about it, I don’t think that’s it’s related, the issue occurs when there is a 90 degree slope or edge, but in mine the applied surface where it’s working vs the one wher it’s distorded is identical.