Considering that you already know how to build a simple example of Vuforia in UNITY, I´m going to register here a simple way to add dynamic 3D text.
1) First of all, insert a 3D Text in the scene. Go to menu GameObject > 3D Object > 3D Text. Write any text in there and call it "dynamicText";
2) Move this 3D Text into ImageTarget;
2) Create a C# Script. Right button on Asset windows > create > C# Script.
Write this code in there:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class textScript : MonoBehaviour {
// Define this variable will allow you to associate your 3D Text.
// To associate it you have to grab the
[SerializeField]
private TextMesh changeTextMesh = null;
// Use this for initialization
void Start () {
changeTextMesh.text = "This is the new text";
}
// Update is called once per frame
void Update () {
}
}
3) Save it and go back to the scene. Grab this C# script into the ImageTarget;
4) Grab the dynamicText into the changeTextMesh variable that is obviously located in the ImageTarget inspector (where you input your C# Script)
5) By the time you connect the dynamicText with changeTextMesh it will work like a charm.
Nenhum comentário:
Postar um comentário