react-three-csg icon indicating copy to clipboard operation
react-three-csg copied to clipboard

guidance for using this library with TextGeometry?

Open prechapl opened this issue 2 years ago • 2 comments

I'd like to to subtract text geometry from a mesh but I have not been able to get it to work. I get this error:

TypeError: Cannot read properties of undefined (reading 'count') at ensureIndex (buildFunctions.js:13:1) at buildTree (buildFunctions.js:737:1) at buildPackedTree (buildFunctions.js:791:1) at new MeshBVH (MeshBVH.js:164:1) at Brush.prepareGeometry (Brush.js:68:1) at Evaluator.evaluate (Evaluator.js:137:1) at index.js:68:1 at index.js:91:1 at commitHookEffectListMount (react-reconciler.development.js:14669:1) at commitLayoutEffectOnFiber (react-reconciler.development.js:14781:1)

prechapl avatar Feb 28 '23 21:02 prechapl

Hi! I have the same issue. What I did to partially solve it was to use <textGeometry> inside <Substraction> (my case) <textGeometry args={['Test', { font, size: 1, height: 1 }]} /> where font is const font = new FontLoader().parse(myFont); and myFont it's a custom imported font import myFont from '/fonts/GreatVibes_Regular.json';

However, it seems that this approach requires more resources, because it takes longer to process.

marcofiletto avatar Apr 03 '23 18:04 marcofiletto

https://github.com/pmndrs/react-three-csg/issues/17

marcofiletto avatar Apr 12 '23 02:04 marcofiletto