CapsuleGeometry with TextGeometry in one group

I’m trying to make a capsule with text inside with three js, but receiving just a capsule with cube inside instead of text, what is wrong with my code, can anyone help me pls with this one?

 const capsule = new Mesh(new CapsuleGeometry(3, 3, 32), new MeshLambertMaterial({
                    color: 'red',
                    transparent: true,
                    opacity: 0.4
                }))

                const text = new Mesh(new TextGeometry('500', {
                    height: 5, curveSegments: 12, bevelEnabled: true, bevelThickness: 10, bevelSize: 8, bevelOffset: 0, bevelSegments: 5
                }), new MeshBasicMaterial({
                    color: 'black',
                    transparent: false,
                    opacity: 1
                }));

                const group = new Group();
                group.add(capsule);
                group.add(text);
                return group

Hi!
You’ve got no font property in parameters for TextGeometry. Have a look: https://codepen.io/prisoner849/pen/yLRPwyv?editors=0010

2 Likes

works like a charm, thx a lot

1 Like