I'm new to unity and 3D world developement so I'm following Unity's tutorial for beginners right here. And I'm in the section with title "Camera Nodes" where they gave me a c# script to attach it to the camera object.
I did attach it to the camera but the problem with the script when I debug it I get an error of undefined class:
The name 'InputTracking' does not exist in this context
And this is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpdateEyeAnchors : MonoBehaviour {
GameObject[] eyes = new GameObject[2];
string[] eyeAnchorNames = { "LeftEyeAnchor", "RightEyeAnchor" };
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
for (int i = 0; i < 2; ++i)
{
// If the eye anchor is no longer a child of us, don't use it
if (eyes[i] != null && eyes[i].transform.parent != transform)
{
eyes[i] = null;
}
// If we don't have an eye anchor, try to find one or create one
if (eyes[i] == null)
{
Transform t = transform.Find(eyeAnchorNames[i]);
if (t)
eyes[i] = t.gameObject;
if (eyes[i] == null)
{
eyes[i] = new GameObject(eyeAnchorNames[i]);
eyes[i].transform.parent = gameObject.transform;
}
}
// Update the eye transform
eyes[i].transform.localPosition = InputTracking.GetLocalPosition((VRNode)i);//--the error is this line
eyes[i].transform.localRotation = InputTracking.GetLocalRotation((VRNode)i);//--and this one
}
}
}
This is the link of the class InputTracking in Unity's API, but I don't know how to add it to my script :)
Thanks in advance.
using UnityEngine.VR;to the top? \$\endgroup\$