Info bubble
In a comic book, when a character says something, it's shown in a speech bubble. In many online social VR worlds, participants are represented by avatars and, hovering above someone's avatar, their name is displayed. I'll call this type of user interface an info bubble.
Info bubbles are located in world space at a specific 3D position, but the canvas should always be facing the camera. We can ensure this with a script.
In this example, we'll display the X
, Z
location of the WalkTarget
object (set up in Chapter 4, Gaze-Based Control), controlled by the LookMoveTo.cs
script. To add the info bubble, perform the following steps:
- From the
Project
window, drag theDefaultCanvas
prefab directly into theHierarchy
window so that it's a child ofWalkTarget
. - Rename it to
InfoBubble
. - With
InfoBubble
selected, set theRect Transform
component'sPos X
,Pos Y
,Pos Z
to (0
,0.2
,0
). - With
Text
underInfoBubble
selected, set theRect Transform
component'sPos X
,Pos Y
,Pos Z
to (0
,0
,0
) andRight
...