I’m trying to get a text bubble for an NPC. But I’m having a problem with the camera. Currently I’ve got it to sort of follow the NPC game object, but the camera is my main concern. As the camera follows the character, the camera moves along. Since the GUI is a screen element and the camera only controls the world, what should I do about making the GUI move along with the camera?
I’m not super clear on what you are wanting to do. Could you explain more on what you are trying to accomplish?
A probably more simple way (than trying to get normal GUI to position well with camera) would be to make a GUI layer (custom material, different render predicate) that is drawn the same way as game objects are, and then communicate positioning offset in whatever way works best for you (shared modules maybe).
In short I’m trying to have a GUI Text Node be attached to my NPC Object so the Text Node is always right above the NPC.
I believe making an entirely new GUI layer would open a whole new can of worms, so to speak. Right now dialog is easy to load and display.
(Also, I won’t be able to reply again until the next day. It’s almost 6am)
I woke up this morning with the answer, And fixed it. But couldn’t post until after my day was finished.
All I had to do was take the screen resolution, minus it by the camera position, and then apply the NPC’s position in the world.
Posting this in case somebody else has this question.
You can solve this by creating a separate gui for the text nodes and assign it a new material and set adjust mode to Disabled
(select the root node of the gui and change both of these in the properties panel). With a new material and adjust mode set to none it will be possible to render the text nodes in the same screen space as the game objects using a custom render script. I have created an example that shows how to do this:
Try it here:
http://britzl.github.io/publicexamples/text_on_go/index.html