【发布时间】:2017-09-21 17:38:01
【问题描述】:
我是 Unity3D 的初学者,与游戏开发有关。最近,我正在尝试做一个简单的程序,以便在 HoloLens 中实现它。目标是让 3D 文本(“_text”)沿相机移动的方向移动,效果非常好。但是,当我(使用 HoloLens)(+/-)90 度移动我的头时,我无法阅读文本,因为我没有面对文本,在 180 度时我看到我的 3d 文本倒置了。如果有人可以帮助我,我将不胜感激。 :)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextManager : MonoBehaviour {
public GameObject _text;
public TextMesh _startText;
// Use this for initialization
void Start () {
if (_text == null) _text = GameObject.Find("StartText");
if (_startText == null) _startText = GameObject.Find("StartText").GetComponent<TextMesh>();
}
// Update is called once per frame
void Update () {
if (_text.activeSelf)
{
var camPos = Camera.main.transform.position + Camera.main.transform.forward;
_text.transform.position = camPos;
_text.transform.localScale = Vector3.one * 0.025f;
}
else
{
Debug.Log("deactive _startText");
}
}
}
【问题讨论】: