Skip to content

setText with TextGeometry during runtime? #4324

@echteinfachtv

Description

@echteinfachtv

Thanks for ThreeJS, great stuff, good to learn with the examples. One issue that I face currently is that I cannot change the text at runtime. My code:

var text3dparams = {
    size:           0.3,    // size of the text
    height:     0.05,   // thickness to extrude text
    curveSegments: 2,       // number of points on the curves
    font:           'helvetiker',       // font name
    weight:         'normal',       // font weight (normal, bold)
    style:      'normal',       // font style  (normal, italics)
}
var material = new THREE.MeshBasicMaterial({color: 0xFF5555});
var text3d_volume = new THREE.TextGeometry( "V = 300 m³", text3dparams );
var text3dItemV = new THREE.Mesh(text3d_volume, material); 
scene.add(text3dItemV);

I create a cube and label its edges (but labels are not updating the text values): http://www.echteinfach.tv/3d/quader/

Question is, how can the text be changed at runtime?

I hoped there is something like setText("new text"); but there is not :(

Unfortunately, the text example provided in the source is not using TextGeometry. Other examples I found just add the text but never change it at runtime.


PS: I see only one workaround to remove the 3d text and add it again on every update in render()?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions