bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.39k stars 3.59k forks source link

Text Gizmos #16490

Open Sigma-dev opened 1 day ago

Sigma-dev commented 1 day ago

What problem does this solve or what need does it fill?

Gizmos are mainly used (atleast from my experience) to quickly add information vizualization without much effort They fill this work great, but sometimes we want to gizmo more complex data visible than shapes can handle. Things like names, lengths, values etc...

What solution would you like

gizmos.text(position, size, "text");
gizmos.text_2d(position, size, "text");

Would draw text always upright always facing the camera. The size given would be in world space, so the text would be sized according to distance like any other object. The 3d/2d variants simply change the position to be Vec2 vs Vec3

What alternative(s) have you considered?

Logging is not as indicative, I can't thing of any thing that could get the diversity of information like a text gizmo would.

Additional context

The simplest way to get something like it working would be to encode every alpha-numeric character as a shape (a-z A-Z 0.9 and maybe some symbols). Then only allow these characters to be displayed.

Fonts are kind of a pain to implement, though bevy already has abstractions around them but I don't know enough to know if it's a viable approach.

If the manual symbol approach is chosen then I could probably implement it and open a PR for it.

alice-i-cecile commented 30 minutes ago

I'd like to try and integrate this with Bevy's existing text rendering if possible. This is doubly useful with weird symbol fonts. I share the desire for quick-and-dirty worldspace text for debugging though!