felixmariotto / three-mesh-ui

⏹ Make VR user interfaces for Three.js
https://felixmariotto.github.io/three-mesh-ui/#basic_setup
MIT License
1.3k stars 136 forks source link

how do I make the text double sided? #241

Closed rishipandey125 closed 1 year ago

rishipandey125 commented 1 year ago

When I add text to my container and then try to access the text.fontMaterial property - it just returns undefined.

I want to set text.fontMaterial.side = THREE.DoubleSide

swingingtom commented 1 year ago

Hey @rishipandey125 , You should follow this https://github.com/felixmariotto/three-mesh-ui/issues/233#issuecomment-1295108493

rishipandey125 commented 1 year ago

Thanks! I am still getting undefined though for my text.fontSide when I set my fontSide to THREE.DoubleSide

swingingtom commented 1 year ago

Hello @rishipandey125,

Because it doesn't exist in threemeshui. This is explained in the linked comment.

v6.x.x A bit more difficult, as meshes for text are not directly available after object creation. We need to wait to be built, and redo each time it changes.

// listen for mesh creation/update myText.onAfterUpdate = () => { if (myText.children.length > 0) { myText.children[0].material.side = DoubleSide; } };