+1 vote

Hello,
I'm making a game in VR and I need some text but i coun't find any node that can help?
I need some flat text editable from the Godot UI or by code.
Anyone know some solution?

Godot version 3.3.2
in Engine by (15 points)

3 Answers

0 votes

Use a sprite3d

by (270 points)

How, exactly?

Sprite3D isused to display 2d pictures in 3d scene. I don't thing you would by able to show the text using it. If you have the writing as png then it might work

By using a ViewportTexture (with your text in a Viewport).

DinDinDin, sorry that it's been a bit unclear.
Later on I'd like to give a proper answer for your question, but for now I have this project on Github, it is mostly irrelevant to the topic but it does have an example of a Sprite3D/Viewport text if you'd like to look into it:

Sprite3D

Yep! it works great but also I think using viewport is good option for showing 3d health bars, levels of mob or anything else. But don't think if it's good for showing on UI. It would somewhat look like a blackboard (not really, just a comparison). That's why I stated that.

0 votes

See the 3D waypoints demo for an example of this.

by (10,271 points)

Hi!
Is my way (the way i suggested) good or do it needs any improvement?
I use to do this without any error but I am wondering is this the best way.

Help me please, using your method is perfectly OK for static UI. I use that myself for all my menus, but the important distinction here is that even the nodes are "in a 3D scene," you're actually displaying a 2D scene over your 3D one. It's still a 2D scene and it acts like one.

For "in-world" 3D text elements (such as name tags), you would want the text to act like a 3D element by being anchored to a certain point in 3D space. You can estimate this point through the use of camera raycasting with Spatial node, essentially what Callinou was suggesting with the "3D Waypoints" tutorial.

However, that isn't the perfect solution either, as the text element will not resize at all, no matter how far it is from the camera (without scripting).
For this reason, the ultimate in-world solution text is to use a 3D Sprite with a Viewport texture as Snail0259 was trying to suggest but with only half of the essential details and no instructions. The 3D sprite is an actual 3D element and its display is very intuitive for the game designer.


I hope it's somewhat informative!

Thanks!
I am 70% noob that's why I don't know much.

Thank you again for the information

+1 vote

Hi!
You want to show 2d text in 3d environment?

The best way I know is:-

  1. Convert your spatial root to node.
  2. Then add a label to your scene.
  3. Set its position, scale, size in 2d editor.
  4. When you will run the scene you will find the label where you had set its position

Rather than label you can also use other control nodes to do so
I always use this way to display my UI in a 3D scene

by (870 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.