private void ScaleTracking(float deltaY) { IVR_UnityVRHead unityVRhead = headTarget.GetComponent <IVR_UnityVRHead>(); if (unityVRhead.cameraRoot != null) { unityVRhead.extension.trackerPosition += new Vector3(0, deltaY, 0); } }
public override void StartExtension(InstantVR ivr) { base.StartExtension(ivr); IVR_UnityVRHead unityVrHead = ivr.headTarget.GetComponent <IVR_UnityVRHead>(); unityVrHead.cameraRoot = new GameObject("UnityVR Root"); unityVrHead.cameraRoot.transform.parent = ivr.transform; }
void OnDestroy() { if (ivrUnity == null && ivr != null) { unityHead = ivr.headTarget.GetComponent <IVR_UnityVRHead>(); if (unityHead != null) { DestroyImmediate(unityHead, true); } } }
public void Calibrate() { foreach (Transform t in headTarget.parent) { t.gameObject.SendMessage("OnTargetReset", SendMessageOptions.DontRequireReceiver); } float neckHeight = headTarget.transform.position.y - transform.position.y; float deltaY = avatarNeckHeight - neckHeight; IVR_UnityVRHead unityVRhead = headTarget.GetComponent <IVR_UnityVRHead>(); if (unityVRhead.cameraRoot != null) { unityVRhead.extension.trackerPosition += new Vector3(0, deltaY, 0); } }
void OnEnable() { ivrUnity = (IVR_UnityVR)target; if (!ivrUnity) { return; } ivr = ivrUnity.GetComponent <InstantVR>(); if (ivr != null) { unityHead = ivr.headTarget.GetComponent <IVR_UnityVRHead>(); if (unityHead == null) { unityHead = ivr.headTarget.gameObject.AddComponent <IVR_UnityVRHead>(); unityHead.extension = ivrUnity; } IVR_Extension[] extensions = ivr.GetComponents <IVR_Extension>(); if (ivrUnity.priority == -1) { ivrUnity.priority = extensions.Length - 1; } for (int i = 0; i < extensions.Length; i++) { if (ivrUnity == extensions[i]) { while (i < ivrUnity.priority) { MoveUp(unityHead); ivrUnity.priority--; //Debug.Log ("Rift Move up to : " + i + " now: " + ivrRift.priority); } while (i > ivrUnity.priority) { MoveDown(unityHead); ivrUnity.priority++; //Debug.Log ("Rift Move down to : " + i + " now: " + ivrRift.priority); } } } } }