2019-03-04 17:07:53 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Vuforia;
|
|
|
|
|
|
|
|
|
|
public class make_text : MonoBehaviour, ITrackableEventHandler
|
|
|
|
|
{
|
|
|
|
|
private TrackableBehaviour mTrackableBehaviour;
|
|
|
|
|
private TextMesh textQuad;
|
|
|
|
|
|
|
|
|
|
public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
|
|
|
|
|
{
|
|
|
|
|
if (newStatus == ImageTargetBehaviour.Status.TRACKED ||
|
|
|
|
|
newStatus == ImageTargetBehaviour.Status.DETECTED ||
|
|
|
|
|
newStatus == ImageTargetBehaviour.Status.EXTENDED_TRACKED)
|
|
|
|
|
{
|
2019-03-06 15:40:24 +00:00
|
|
|
|
|
|
|
|
|
var rotation = gameObject.transform.rotation.eulerAngles.y;
|
|
|
|
|
print($"The rotation: {rotation}");
|
|
|
|
|
print($"rotation / 45: {rotation / 45}");
|
|
|
|
|
var letter = gameObject.name[(int)(rotation / 45)].ToString();
|
|
|
|
|
print($"The letter: {letter}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (letter == "1")
|
2019-03-04 17:07:53 +00:00
|
|
|
|
{
|
|
|
|
|
textQuad.text = textQuad.text.Remove(textQuad.text.Length - 1);
|
|
|
|
|
}
|
2019-03-06 15:40:24 +00:00
|
|
|
|
else if (letter == "0")
|
|
|
|
|
{
|
|
|
|
|
textQuad.text += " ";
|
|
|
|
|
} else if (letter == "9")
|
|
|
|
|
{
|
|
|
|
|
textQuad.text += "<3";
|
|
|
|
|
}
|
2019-03-04 17:07:53 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2019-03-06 15:40:24 +00:00
|
|
|
|
textQuad.text += letter;
|
2019-03-04 17:07:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
textQuad = GameObject.Find("TextQuad").GetComponent<TextMesh>();
|
|
|
|
|
|
|
|
|
|
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
|
|
|
|
|
if (mTrackableBehaviour)
|
|
|
|
|
{
|
|
|
|
|
mTrackableBehaviour.RegisterTrackableEventHandler(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
2019-03-06 15:40:24 +00:00
|
|
|
|
{
|
|
|
|
|
var rotation = gameObject.transform.rotation.eulerAngles.y;
|
|
|
|
|
print($"The rotation: {rotation}");
|
|
|
|
|
print($"rotation / 45: {rotation / 45}");
|
2019-03-04 17:07:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|