Show dynamic text on paper with Vuforia, augmented for iOS and Android

I have a requirement to show text on paper when a mobile device places it on paper, this is basically an augmented reality function.

There will be a creator in the document, and the application itself will recognize the marker and should place the dynamic text that it receives from the server. So this text will change

So, in the beginning I decided to move with the Vuforia SDK, as it has more support than any other sdks available. Therefore, I managed to run sample applications there and show there a “tea pot” in my own marker,

But now the hardest part - I need to display text on a marker instead of a tea pot. so it seems I have two options

1) Using a unit, create a 2d text object 2) Using openGL rendering text, as in a teapot

So my question is, what is the appropriate way to do this? I know that OpenGL is not easy to implement, even Unity will provide several unnecessary files that have both pros and cons.

What is the best way to do this?

+6
source share
2 answers

So, after reading several articles, I managed to place GuiLabel on top of a real-world object. All this involved using WorldToScreenPoint and setting it to

Camera cam=Camera.current; GUIStyle textStyle = new GUIStyle (); textStyle.fontSize = 40; textStyle.normal.textColor = Color.yellow; Vector3 pos=cam.WorldToScreenPoint(targetPosition); GUI.Label(new Rect(pos.x-40,Screen.height-pos.y,250,200),"Product Price",textStyle); 
0
source

You get text from the server, say a json file. Parse it and apply the result to a text object or Text object in the canvas of the world.

https://docs.unity3d.com/Manual/class-TextMesh.html

https://unity3d.com/fr/learn/tutorials/topics/user-interface-ui/ui-text

You can place this object in place of the tea pot under the image target, or change the DefaultTrackableEventHandler so that instead of influencing Collider and Renderer on the child object, it will act on any object.

Look for the OnTrackingFound / Lost methods.

+5
source

Source: https://habr.com/ru/post/1015619/


All Articles