Billboard through javascript

Hi, it seems that the example in doesn’t work.
I eman: the link to the example itself launch the example in action, but a part the first cretaeTextBillboard command, all the others doesn’t take effect. If i copy the code in my scene, i get the same results…
did you change the syntax and forgot to change the docs, or do i miss some step?


1 Like

Hi mariochiesa,

thanks for pointing that out! There has been a change in the API regarding texts, which has not been reflected in the documentation yet.

Now, the item created by Scene.createTextBillboard() is a Cuboid-Item with a Text-Item attached as a child. There’s also a new method called Scene.createText() to only make the Text-Item itself. Below are some examples:

1. How to make the new text item

let text = Scene.createText(0, 0, 1, "Hello World!");
text.setColor(255, 0, 0); 

See this example in action

2. How to make a text billboard item
The item created with Scene.createTextBillboard is simply a Cuboid-Item with a Text-Item as a child. You can call methods on the Cuboid and it will set properties on the Text-Item it has as a child.

let textBillboard: Cuboid = Scene.createTextBillboard(0, 0, 1);
textBillboard.setTextColor(255, 255, 255);
textBillboard.setColor(0, 205, 170);

See the example in action

We’ll be updating the documentation page accordingly. Hope this helps!


Thank you so much! Prompt and helpful as usual!

I tried but I can’t change the text in billboard.The program reports an error that the property “setText” does not exist.

Hi Sarah, the Scene.createText method no longer exists - you’ll need to create/get a TextItem object and use the text property to update the text. See TextItem | for details.

Let me know if you have any questions about this.


1 Like