question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setText with TextGeometry during runtime?

See original GitHub issue

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()?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
q2aprocommented, Jun 30, 2017

Really would be helpful to have text as a parameter to be set at runtime…

For the docs: https://threejs.org/docs/#api/geometries/TextGeometry

4reactions
toughrogrammercommented, Oct 3, 2014

is there plan about supporting this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextGeometry performance in Three.js - Stack Overflow
Using a basic scene i'm having, it takes a lot of times to load each text. The code is here: function setText(text, textColor,...
Read more >
✎ Create 3D text at runtime? - Questions - three.js forum
Is there a way to create 3D text at runtime? Without using the sIFR approach: https://threejs.org/docs/#api/geometries/TextGeometry helvetiker_regular.typeface.
Read more >
How to access text element from a .dae file in SceneKit?
I want to load this .dae file and want to update text on that label at runtime so user name will come there....
Read more >
Project with specific transformation | ArcGIS Runtime API for ...
See Spatial references in the ArcGIS Runtime SDK for . ... to label the output TextView beforeLabelTitle = new TextView(this) { Text =...
Read more >
Changelog | TextMeshPro | 3.0.6 - Unity - Manual
EndSample() in the TMP_FontAsset.cs file. See forum post for details. Fixed SetText() with formatting issue where large numbers would show a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found