Is it possible to use RoundedBox with react-three-csg?


Hi, i’m trying to subtract a Drei <RoundedBox/> from another geometry. I tried it with just setting it in the Subtraction tag like i did it with <boxGeometry/> this does not work. My other attempt was to try it with useRef and inserting the roundedBox.current.geometry into the Subtraction. Unfortunatly the useRef() is undefined. I saw a while ago how to solve this useRef undefined issue but i cannot remeber how to solve it. Here is a sandbox i tried it with:

<RoundedBox> is a mesh, it wants geometry. threejs has a roundedboxgeometry

import { extend } from '@react-three/fiber'
import { RoundedBoxGeometry } from 'three-stdlib'

extend({ RoundedBoxGeometry })

    <roundedBoxGeometry />

arguably though <RoundedBox> is limited as a mesh, it should probably be <RoundedBoxGeometry> and it would be much more versatile. applies to all of these drei geometry shortcuts but we didn’t see it like that back then. if you want you could make a PR.

1 Like