Hi all!
I made speech bubbles as TCastleUserInterface class. Now I want to make this bubbles follow to the 3D character across the screen.
As I understand, I need to take TVector3 coordinates, for example, of the character’s top point and translate those coordinates into screen TVector2 coordinates. But how can I do this?
PS: This question has probably already been raised on the forum, but I couldn’t find the relevant topic.
The TCastleViewport.PositionFromWorld is what you need 
We have a demo that shows using it, to display a UI element (TCastleLabel
) at a position that exactly matches the position of a 3D object inside a TCastleViewport
, see examples/viewport_and_scenes/position_from_world/.
Note: An alternative would be to make speech bubbles using meshes with text using TCastleText. Then you can put speech bubbles inside TCastleViewport
. That’s the approach we followed in the end in “The Unholy Society” ( Unholy Society ), after a bit of experimentation. It allowed to use Blender to design speech bubbles shapes, although adjusting the size of these predesigned bubbles to fit the text precisely was some additional work. Making speech bubbles as you describe, using TCastleUserInterface
, would be probably my first choice nowadays, as then you can use our UI system sizing properties (to adjust to parent/children in various ways).
1 Like
Thanks for Your help! It working!
I just little didn’t scroll through the examples to the right ones 
1 Like