public virtual bool AddTracker(HumanoidControl humanoid, string resourceName) { GameObject realWorld = HumanoidControl.GetRealWorld(humanoid.transform); trackerTransform = FindTrackerObject(realWorld, name); if (trackerTransform == null) { GameObject model = Resources.Load(resourceName) as GameObject; if (model != null) { GameObject trackerObject = GameObject.Instantiate(model); trackerObject.name = name; trackerTransform = trackerObject.transform; } else { GameObject trackerObject = new GameObject(name); trackerTransform = trackerObject.transform; } trackerTransform.parent = realWorld.transform; trackerTransform.position = humanoid.transform.position; trackerTransform.rotation = humanoid.transform.rotation; return(true); } return(false); }
public static void AddTracker(HumanoidControl humanoid) { // you cannot find a tracker in a disabled gameObject if (!humanoid.gameObject.activeInHierarchy) { return; } GameObject realWorld = HumanoidControl.GetRealWorld(humanoid.transform); Transform trackerTransform = realWorld.transform.Find(UnityVRDevice.trackerName); if (trackerTransform == null) { UnityVRDevice.trackerObject = new GameObject { name = UnityVRDevice.trackerName }; UnityVRDevice.trackerObject.transform.parent = realWorld.transform; UnityVRDevice.trackerObject.transform.localPosition = Vector3.zero; } else { UnityVRDevice.trackerObject = trackerTransform.gameObject; } }
public virtual void StartTracker(HumanoidControl _humanoid) { humanoid = _humanoid; GameObject realWorld = HumanoidControl.GetRealWorld(humanoid.transform); Init(realWorld.transform); }
public Transform GetRoot(HumanoidControl humanoid) { if (unityVRroot == null) { GameObject realWorld = HumanoidControl.GetRealWorld(humanoid.transform); unityVRroot = realWorld.transform.Find(UnityVRDevice.trackerName); if (unityVRroot == null) CreateUnityVRRoot(realWorld.transform); } return unityVRroot; }
public static GameObject AddTracker(HumanoidControl humanoid) { GameObject realWorld = HumanoidControl.GetRealWorld(humanoid.transform); humanoid.kinectTracker.trackerTransform = FindTrackerObject(realWorld, NativeKinectDevice.name); if (humanoid.kinectTracker.trackerTransform == null) { humanoid.kinectTracker.trackerTransform = CreateTracker(); humanoid.kinectTracker.trackerTransform.transform.parent = realWorld.transform; } return(humanoid.kinectTracker.trackerTransform.gameObject); }
private void CreateUnityVRRoot() { GameObject realWorld = HumanoidControl.GetRealWorld(headTarget.humanoid.transform); unityVRroot = realWorld.transform.Find(UnityVRDevice.trackerName); if (unityVRroot == null) CreateUnityVRRoot(realWorld.transform); unityVRroot.parent = realWorld.transform; #if hOCULUS if (UnityVRDevice.xrDevice == UnityVRDevice.XRDeviceType.Oculus) unityVRroot.localPosition = new Vector3(0, OculusDevice.eyeHeight, 0); #endif }
private void CreateScreen(HeadTarget headTarget) { GameObject realWorld = HumanoidControl.GetRealWorld(headTarget.humanoid.transform); headTarget.screenTransform = realWorld.transform.Find("Screen"); if (headTarget.screenTransform == null) { GameObject screenObj = GameObject.CreatePrimitive(PrimitiveType.Cube); //new GameObject("Screen"); screenObj.name = "Screen"; headTarget.screenTransform = screenObj.transform; headTarget.screenTransform.parent = realWorld.transform; headTarget.screenTransform.localPosition = headTarget.transform.position + headTarget.transform.forward; headTarget.screenTransform.rotation = headTarget.transform.rotation * Quaternion.AngleAxis(180, Vector3.up); headTarget.screenTransform.localScale = new Vector3(0.476F, 0.2677F, 0.02F); // 21.5 inch 16:9 screen size } }
public virtual void StartTracker(Transform trackerTransform) { GameObject realWorld = HumanoidControl.GetRealWorld(trackerTransform); Init(realWorld.transform); }