Hello everyone, there is such a problem. I need to place 3D text around the model. I found this solution, but I get an error
main.js:105 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length’)

Can’t find vertices.

My code

``````var circleRadius = 0.27;
var textGeometry = new TextGeometry.TextGeometry('Your Text', {
font: font,
size: 0.05,  // Adjust the size as needed
height: 0.02,
curveSegments: 12,
bevelEnabled: false,
});

console.log(textGeometry.isBufferGeometry);

var textMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff });
var textMesh = new THREE.Mesh(textGeometry, textMaterial);

// Position the text along the circle
var angleStep = (Math.PI * 2) / textGeometry.vertices.length;

for (var i = 0; i < textGeometry.vertices.length; i++) {
var angle = angleStep * i;
var x = Math.cos(angle) * circleRadius;
var z = Math.sin(angle) * circleRadius;
textGeometry.vertices[i].x = x;
textGeometry.vertices[i].z = z;
}

// Add text to the model

});
``````

Your code uses deprecated Geometry - removed in r125 - you would need to iterate through BufferGeometry position attribute in order to retrieve the vertices.

Thanks, but how do I do it for this code?

Try this?

``````let vt = textGeometry.attributes.position.array;
for (var i = 0; i < vt.length; i+=3) {
var angle = angleStep * i;
}
``````

But… I don’t think this will do what you want it to anyway…

I think you want to base the rotation off the x position of the vertex… if you’re trying to wrap it around something…

let vt = textGeometry.attributes.position.array;
for (var i = 0; i < vt.length; i+=3) {
var angle = vt[i] * 0.01; //Adjust this

``````                        vt[i] = Math.cos(angle) * circleRadius;
}
``````

Thank you for your time manthrax, I tried to do as you advised, but now I don’t see the text at all.

``````                var modelRadius = 27;
var textGeometry = new TextGeometry.TextGeometry('Your Text', {
font: font,
size: 0.05,  // Adjust the size as needed
height: 0.02,
curveSegments: 12,
bevelEnabled: false,
});

console.log(textGeometry.isBufferGeometry);

let vt = textGeometry.attributes.position.array;
for (var i = 0; i < vt.length; i+=3) {
var angle = vt[i] * 0.01; //Adjust this
}

var textMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff });
var textMesh = new THREE.Mesh(textGeometry, textMaterial);

// Add text to the model

});
``````

Thank you for your time manthrax I have such a solution

`````` var loader = new FontLoader.FontLoader();
this.textGeometry = new TextGeometry.TextGeometry(values.text_emb_one_side, {
font: font,
size: 0.02,
height: 0.03,
curveSegments: 12,
bevelEnabled: false,
});

this.textMaterial = new THREE.MeshBasicMaterial({
color: 0x000000,
});

this.textMesh = new THREE.Mesh(this.textGeometry, this.textMaterial);

textMesh.position.set(0, 0, 0);