I have a GLTF model that has a decal geometry on one of its meshes, and I want to use dragControl to change the position of the decal image, but the texture should be within the mesh and not come out of it, or show the part that came out. not be given
If you want to drag the decal onto the surface, you canāt just drag the final decal mesh with DragControls. Instead, you need to constantly project the decal onto the surface by re-creating it every time you move it. If you do so, do not forget to call dispose() on the previous instance of DecalGeometry to avoid a memory leak.
If you intend to change the decal several times in your application, maybe an alternative way is to think of it as a projector. There are two ways to do this already implemented.
- First, by using an spotlight and leveraging .map property, which projects a texture from light position. Go and try official example and reduce āangleā to see the effect.
- Second, using Marco Fugaroās āthree-projected-materialā plugin, which does exactly that, and make the projector a child of the geometry to stick to it and preserve projection.
Using any of these you should be able to freely move the ādecal originā, i.e. by using transformControls or similar