私はちょうどGoogle Tangoについて何かを学び始めました。ローカルエリア記述の学習を実装する方法を理解する上でいくつか問題があります。私はドキュメンテーションのハウツーガイドの1つ、ARに仮想オブジェクトを配置したもの、そしてそれらの子猫が置かれた場所をアプリケーションが覚えておきたいと思った。私はUnityからのシーンと、私がAreaDEscriptionのSaveCurrentメソッドを有効にしようとしたスクリプトを添付します。 The scene from Unity次のコードは、主に私は十分評判ポイントを持っていないからハウツー・ガイド私は現在AreaDescriptionローカルエリアの説明:ラーニング
public class KittyUIController : MonoBehaviour
{
Thread thread;
public GameObject m_kitten;
private TangoPointCloud m_pointCloud;
void Start()
{
m_pointCloud = FindObjectOfType<TangoPointCloud>();
thread = new Thread(Thread123);
}
void Update()
{
if (Input.touchCount == 1)
{
// Trigger place kitten function when single touch ended.
Touch t = Input.GetTouch(0);
if (t.phase == TouchPhase.Ended)
{
PlaceKitten(t.position);
thread.Start();
}
}
}
void PlaceKitten(Vector2 touchPosition)
{
// Find the plane.
Camera cam = Camera.main;
Vector3 planeCenter;
Plane plane;
if (!m_pointCloud.FindPlane(cam, touchPosition, out planeCenter, out plane))
{
Debug.Log("cannot find plane.");
return;
}
// Place kitten on the surface, and make it always face the camera.
if (Vector3.Angle(plane.normal, Vector3.up) < 30.0f)
{
Vector3 up = plane.normal;
Vector3 right = Vector3.Cross(plane.normal, cam.transform.forward).normalized;
Vector3 forward = Vector3.Cross(right, plane.normal).normalized;
Instantiate(m_kitten, planeCenter, Quaternion.LookRotation(forward, up));
}
else
{
Debug.Log("surface is too steep for kitten to stand on.");
}
}
void Thread123()
{
AreaDescription.SaveCurrent();
}
public void OnApplicationQuit()
{
thread.Abort();
}
}