// Update is called once per frame void Update() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); //var point = rays.left.GetPoint(1.0f); //indicator.transform.position = point; RaycastHit hit; Physics.Raycast(rays.right, out hit, Mathf.Infinity); var vector1 = hit.point - node1.transform.position; var vector2 = node2.transform.position - node1.transform.position; var angle1 = Vector3.Angle(vector1, vector2); var vector3 = hit.point - node2.transform.position; var vector4 = node1.transform.position - node2.transform.position; var angle2 = Vector3.Angle(vector3, vector4); //Debug.LogFormat("angle 1: {0}, angle 2: {1}", angle1, angle2); highlight(angle1, angle2); if (Input.GetKeyDown(KeyCode.Space)) { cleanTargetsOnMenu(); //further selection displayTargetsOnMenu(); } if (Input.GetKeyDown(KeyCode.Escape)) { //clear all targets on menu TargetsController.selectedList.Clear(); } }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { transform.position = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); } else { transform.position = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); } /*Debug.Log("NotWink"); * Debug.Log("Right:" + eyes.right); * Debug.Log("Hit_R:" + hitRight.point); * Debug.Log("Left:" + eyes.left); * Debug.Log("Hit_L" + hitLeft.point);*/ break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitRight.point; } else { transform.position = eyes.right.GetPoint(3.0f); } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitLeft.point; } else { transform.position = eyes.left.GetPoint(3.0f); } break; } }
// Latepdate ensures that the object doesn't lag behind the user's head motion void Update() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); Ray r = rays.left; RaycastHit hit; MeshCollider coll = videoSphere.GetComponent <MeshCollider>(); if (coll != null && coll.Raycast(r, out hit, Mathf.Infinity)) { transform.position = hit.point; } }
void drawLeftEyeRay() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); var origin = rays.left.origin; var merge = rays.left.GetPoint(10f); Debug.Log(origin.x); Debug.Log(merge.x); lineRenderer.numCapVertices = 2; lineRenderer.SetPosition(0, origin); lineRenderer.SetPosition(1, merge); }
// Update is called once per frame private void UpdatePositionBasedOnEyes() { // this is from here.. maybe better robustness against lost tracking: https://github.com/twday/Fove-Unity-Examples/blob/master/Assets/Examples/FoveCursor/Scripts/FoveCursor.cs FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { transform.position = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); } else { transform.position = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); } break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitRight.point; } else { transform.position = eyes.right.GetPoint(3.0f); } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitLeft.point; } else { transform.position = eyes.left.GetPoint(3.0f); } break; } }
// Update is called once per frame void Update() { //時間関連データの取得 nt = DateTime.Now; //ここに到達したときの時刻を取得する TimeSpan ts = nt - st; //実行からどれくらい経過しているのかを計算 //fpsの計算 ++frameCount; float time = Time.realtimeSinceStartup - prevTime; if (time >= 0.5f) { fpstime = frameCount / time; //Debug.LogFormat("{0}fps", fpstime); frameCount = 0; prevTime = Time.realtimeSinceStartup; } //目のデータの取得 FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); //HMD関連のデータの取得 hmdpos = FoveInterface.GetHMDPosition(); //HMDの位置座標 hmdrot = FoveInterface.GetHMDRotation(); //HMDの方向座標 //Debug.Log(hmdpos.x + "," + hmdpos.y + "," + hmdpos.z + "," + hmdrot.x + "," + hmdrot.y + "," + hmdrot.z + "," + hmdrot.w); if (Input.GetKeyDown(KeyCode.Space)) { tf = 1; } if (tf == 1)//csvへの書き込み { //CSVに記録する情報 //現在時刻,現在時刻のミリ秒,経過時間,経過時間のミリ秒,fps,チェッカールームの回転速度,眼球の座標(左),眼球の座標(右),視線のベクトル(左),視線のベクトル(右),HMDの座標,HMDの向き streamWriter.Write(nt.ToString() + ',' + nt.Millisecond.ToString() + ',' + ts.ToString() + ',' + nt.Millisecond.ToString() + ',' + eyes.right.origin.x.ToString() + ',' + eyes.right.origin.y.ToString() + ',' + eyes.right.origin.z.ToString() + ',' + eyes.left.origin.x.ToString() + ',' + eyes.left.origin.y.ToString() + ',' + eyes.left.origin.z.ToString() + ',' + hmdpos.x.ToString() + ',' + hmdpos.y.ToString() + ',' + hmdpos.z.ToString() + ',' + hmdrot.x.ToString() + ',' + hmdrot.y.ToString() + ',' + hmdrot.z.ToString() + ',' + hmdrot.w.ToString()); //csvに書き込むデータのリスト streamWriter.WriteLine(); //データの取得 Debug.Log("書き込み中"); } if (Input.GetKeyDown(KeyCode.S)) { streamWriter.Close();//csvに書き込む Debug.Log("書き込み終了"); } }
void Update() { if (Input.GetKeyDown(VisualizeEyesKey)) { VisualizeEyes = !VisualizeEyes; } if (Input.GetKeyDown(VisualizeMidpointKey)) { VisualizeMidPoint = !VisualizeMidPoint; } FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); // LEFT Ray rayLeft = rays.left; Vector3 leftOrigin = rayLeft.origin; Vector3 leftDirection = rayLeft.direction; Vector3 leftWorldPos = leftOrigin + (DistanceOriginWorldPoint * leftDirection); // RIGHT Ray rayRight = rays.right; Vector3 rightOrigin = rayRight.origin; Vector3 rightDirection = rayRight.direction; Vector3 rightWorldPos = rightOrigin + (DistanceOriginWorldPoint * rightDirection); if (VisualizeEyes) { LeftPointer.transform.position = leftWorldPos; RightPointer.transform.position = rightWorldPos; } // MIDPOINT Vector3 midpoint = (rightWorldPos + leftWorldPos) / 2; if (VisualizeMidPoint) { MidpointPointer.transform.position = midpoint; } var tempObj = GetFocussedHighlightPiece(midpoint); if (tempObj != null) { if (highlightedObject != tempObj) { highlightedObject = tempObj; GazeHighLighter.SetProceduralBox(highlightedObject); } } }
// Latepdate ensures that the object doesn't lag behind the user's head motion void Update() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); // TODO: calculate the convergence point in FoveInterface // Just hack in to use the left eye for now... RaycastHit hit; Physics.Raycast(rays.left, out hit, Mathf.Infinity); if (hit.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hit.point; } else { transform.position = rays.left.GetPoint(3.0f); } }
void FixedUpdate() { if (!recordingTrackingData) { return; } var vp = videoSphere.GetComponent <VideoPlayer>(); if (vp.isPlaying) { nextRecord = Time.time + recordRate; var quaternion = FoveInterface.GetHMDRotation(); var euler = quaternion.eulerAngles; //var leftEyeVector = FoveInterface.GetLeftEyeVector(); //var rightEyeVector = FoveInterface.GetRightEyeVector(); //var leftRay = new Ray(foveInterface.GetEyeCamera(Fove.EFVR_Eye.Left).transform.position, leftEyeVector); //var rightRay = new Ray(foveInterface.GetEyeCamera(Fove.EFVR_Eye.Right).transform.position, rightEyeVector); FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); var leftRay = rays.left; var rightRay = rays.right; //Debug.DrawRay(leftRay.origin, leftRay.direction, Color.green, 2, false); //Debug.DrawRay(rightRay.origin, rightRay.direction, Color.blue, 2, false); Vector2 pixeluvLeft = GetPixelTextureCoords(leftRay); Vector2 pixeluvRight = GetPixelTextureCoords(rightRay); string[] data = new string[] { vp.time.ToString(), euler.x.ToString(), euler.y.ToString(), euler.z.ToString(), quaternion.x.ToString(), quaternion.y.ToString(), quaternion.z.ToString(), quaternion.w.ToString(), leftRay.direction.x.ToString(), leftRay.direction.y.ToString(), leftRay.direction.z.ToString(), rightRay.direction.x.ToString(), rightRay.direction.y.ToString(), rightRay.direction.z.ToString(), pixeluvLeft.x.ToString(), pixeluvLeft.y.ToString(), pixeluvRight.x.ToString(), pixeluvRight.y.ToString(), insideTargetAreaChecker.InsideTargetArea().ToString() }; orientationStringWriter.Write(string.Join(delimiter, data) + "\n"); } }
void getConvergence() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); var leftOrigin = rays.left.origin; var rightOrigin = rays.right.origin; var leftPoint = rays.left.GetPoint(0.1f); var rightPoint = rays.right.GetPoint(0.1f); var dist1 = Vector3.Distance(leftPoint, rightPoint); var dist2 = Vector3.Distance(leftOrigin, rightOrigin); var distance = (float)0.1 * dist2 / (dist2 - dist1); // dist between convergence and origin if (distance > 3.5f) { distance = 3.5f; } //transform.position = rays.left.GetPoint(distance); MoveTowardsTarget(rays.left.GetPoint(distance)); transform.localScale = new Vector3(defaultSize * distance / 5, defaultSize * distance / 5, defaultSize * distance / 5); }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: transform.position = eyes.left.GetPoint(this.distanceFromEye) + ((eyes.right.GetPoint(this.distanceFromEye) - eyes.left.GetPoint(this.distanceFromEye)) / 2); break; case Fove.EFVR_Eye.Left: transform.position = eyes.right.GetPoint(this.distanceFromEye); break; case Fove.EFVR_Eye.Right: transform.position = eyes.left.GetPoint(this.distanceFromEye); break; } }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); for (int i = 0; i < 9; i++) { _object[i].GetComponent <Renderer>().material = _material[0]; } k = 0; eyevector.x = eyevector.y = eyevector.z = 0; truthvector.x = truthvector.y = truthvector.z = 0; //デフォルトの状態のとき if (k == 0) { if (Input.GetKey(KeyCode.Q)) { k = 1; } if (Input.GetKey(KeyCode.W)) { k = 2; } if (Input.GetKey(KeyCode.E)) { k = 3; } if (Input.GetKey(KeyCode.A)) { k = 4; } if (Input.GetKey(KeyCode.S)) { k = 5; } if (Input.GetKey(KeyCode.D)) { k = 6; } if (Input.GetKey(KeyCode.Z)) { k = 7; } if (Input.GetKey(KeyCode.X)) { k = 8; } if (Input.GetKey(KeyCode.C)) { k = 9; } } if (k > 0) { _object[k - 1].GetComponent <Renderer>().material = _material[1]; //ベクトルの取得 switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: eyevector = (FoveInterface.GetLeftEyeVector() + FoveInterface.GetLeftEyeVector()) / 2; truthvector = _object[k - 1].GetComponent <Transform>().position - ((eyes.left.origin + eyes.right.origin) / 2); break; case Fove.EFVR_Eye.Left: eyevector.x = eyevector.y = eyevector.z = 0; truthvector.x = truthvector.y = truthvector.z = 0; //eyevector = FoveInterface.GetRightEyeVector(); //truthvector = _object[k - 1].GetComponent<Transform>().position - eyes.right.origin; break; case Fove.EFVR_Eye.Right: eyevector.x = eyevector.y = eyevector.z = 0; truthvector.x = truthvector.y = truthvector.z = 0; //eyevector = FoveInterface.GetLeftEyeVector(); //truthvector = _object[k - 1].GetComponent<Transform>().position - eyes.left.origin; break; } //なす角の計算 theta = Mathf.Acos(Vector3.Dot(eyevector, truthvector) / (eyevector.magnitude * truthvector.magnitude)) * Mathf.Rad2Deg; Debug.Log(theta);//誤差の表示 streamWriter.Write(k.ToString() + ',' + theta.ToString() + ',' + eyevector.x.ToString() + ',' + eyevector.y.ToString() + ',' + eyevector.z.ToString() + ',' + truthvector.x.ToString() + ',' + truthvector.y.ToString() + ',' + truthvector.z.ToString()); //csvに書き込むデータのリスト streamWriter.WriteLine();//改行 } Debug.Log(k); }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { eyepos = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { eyepos = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2);; //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { eyepos = hitRight.point; //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { eyepos = eyes.right.GetPoint(3.0f); //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { eyepos = hitLeft.point; //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { eyepos = eyes.left.GetPoint(3.0f); //eyepos = eyepos / displaysize; eyepos.x = eyepos.x / displaysize.x; eyepos.y = eyepos.y / displaysize.y; plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; } }
// Update is called once per frame void Update() { //fpsの計算 ++frameCount; float time = Time.realtimeSinceStartup - prevTime; if (time >= 0.5f) { fpstime = frameCount / time; //Debug.LogFormat("{0}fps", fpstime); frameCount = 0; prevTime = Time.realtimeSinceStartup; } //目のデータの取得 FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); //視点の計算 RaycastHit hitLeft, hitRight; Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); originhit = hitLeft.point + ((hitRight.point - hitLeft.point) / 2);//視点座標を代入 //HMD関連のデータの取得 hmdpos = FoveInterface.GetHMDPosition(); //HMDの位置座標 hmdrot = FoveInterface.GetHMDRotation(); //HMDの方向座標 //Debug.Log(hmdpos.x + "," + hmdpos.y + "," + hmdpos.z + "," + hmdrot.x + "," + hmdrot.y + "," + hmdrot.z + "," + hmdrot.w); if (Input.GetKeyDown(KeyCode.Space)) { spintim = 1; n = 90.0f; spinstart = DateTime.Now;//実行を始めた時刻 } if (Input.GetKeyDown(KeyCode.N)) { vectionfeel = 1; //n = 90.0f; } if (spintim == 1) //checkerroomの回転、csvへの書き込み { nt = DateTime.Now; //ここに到達したときの時刻を取得する TimeSpan ts = nt - spinstart; //実行からどれくらい経過しているのかを計算 //経過時刻と角速度に合わせてチェッカールームを傾ける //フレーム当たりの角速度を spinangle = ts.Milliseconds * n / 1000.0f; spinangle += ts.Seconds * n; spinangle += ts.Minutes * n; //spinangle += 0.9f;//Unityは60fpsというのを前提 transform.localRotation = Quaternion.Euler(0.0f, spinangle, 0.0f); //CSVに記録する情報 //現在時刻,現在時刻のミリ秒,経過時間,経過時間のミリ秒,fps,チェッカールームの回転速度,眼球の座標(左),眼球の座標(右),視線のベクトル(左),視線のベクトル(右),視点の座標,HMDの座標,HMDの向き,ベクション streamWriter.Write(nt.ToString() + ',' + nt.Millisecond.ToString() + ',' + ts.ToString() + ',' + nt.Millisecond.ToString() + ',' + fpstime.ToString() + ',' //fps + n.ToString() + ',' //チェッカールームの回転速度 + eyes.left.origin.x.ToString() + ',' + eyes.left.origin.y.ToString() + ',' + eyes.left.origin.z.ToString() + ',' //左目の座標 + eyes.right.origin.x.ToString() + ',' + eyes.right.origin.y.ToString() + ',' + eyes.right.origin.z.ToString() + ',' //右目の座標 + FoveInterface.GetLeftEyeVector().x.ToString() + ',' + FoveInterface.GetLeftEyeVector().y.ToString() + ',' + FoveInterface.GetLeftEyeVector().z.ToString() + ',' //左目ベクトル + FoveInterface.GetRightEyeVector().x.ToString() + ',' + FoveInterface.GetRightEyeVector().y.ToString() + ',' + FoveInterface.GetRightEyeVector().z.ToString() + ',' //右目ベクトル + originhit.x.ToString() + ',' + originhit.y.ToString() + ',' + originhit.z.ToString() + ',' //視点の座標 + hmdpos.x.ToString() + ',' + hmdpos.y.ToString() + ',' + hmdpos.z.ToString() + ',' //HMDの座標 + hmdrot.x.ToString() + ',' + hmdrot.y.ToString() + ',' + hmdrot.z.ToString() + ',' + hmdrot.w.ToString() + ',' //HMDの向き + vectionfeel.ToString()); //ベクション //csvに書き込むデータのリスト streamWriter.WriteLine(); //改行 Debug.Log("書き込み中"); //データ確認用 //Debug.Log(spinstart);//回転開始時 //Debug.Log(nt);//現在時刻 //Debug.Log(ts);//経過時間 //Debug.Log(ts.Milliseconds);//経過時間(ミリ秒) //Debug.Log(spinangle);//移動角 } if (Input.GetKeyDown(KeyCode.S)) { spintim = 0; streamWriter.Close();//csvに書き込む //Debug.Log("書き込み終了"); } if (Input.GetKeyDown(KeyCode.Z)) { n = 180.0f; } if (Input.GetKeyDown(KeyCode.X)) { n = 60.0f; } if (Input.GetKeyDown(KeyCode.C)) { n = 90.0f; } }
void Update() { if (Input.GetKeyDown(VisualizeEyesKey)) { VisualizeEyes = !VisualizeEyes; } if (Input.GetKeyDown(VisualizeMidpointKey)) { VisualizeMidPoint = !VisualizeMidPoint; print("midpoint"); } FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); // LEFT Ray rayLeft = rays.left; Vector3 leftOrigin = rayLeft.origin; Vector3 leftDirection = rayLeft.direction; Vector3 leftWorldPos = leftOrigin + (DistanceOriginWorldPoint * leftDirection); // RIGHT Ray rayRight = rays.right; Vector3 rightOrigin = rayRight.origin; Vector3 rightDirection = rayRight.direction; Vector3 rightWorldPos = rightOrigin + (DistanceOriginWorldPoint * rightDirection); if (VisualizeEyes) { LeftPointer.transform.position = leftWorldPos; RightPointer.transform.position = rightWorldPos; } // MIDPOINT Vector3 midpoint = (rightWorldPos + leftWorldPos) / 2; Vector3 midOrigin = (rightOrigin + leftOrigin) / 2; // print midOrigin; Vector3 midDirection = (rightDirection + leftDirection) / 2; rayMid = new Ray(midOrigin, midDirection); if (VisualizeMidPoint) { MidpointPointer.transform.position = midpoint; } var tempObj = GetFocussedHighlightPiece(midpoint); if (tempObj != null) { if (highlightedObject != tempObj) { highlightedObject = tempObj; GazeHighLighter.SetProceduralBox(highlightedObject); } } //GRAB if (Input.GetKeyDown(KeyCode.Space)) { //print("DOWN" + grabbedObject); if (grabbedObject == null) { TryGrabObject(GetMouseHoverObject(50)); } switch (grabbedObject.name) { case "Scissors": hasScissors = true; break; case "Key": hasKey = true; break; case "Wrench": hasWrench = true; break; } print("GRAB " + (grabbedObject != null)); } if (Input.GetKeyUp(KeyCode.Space)) { // DropObject(); } if (grabbedObject != null) { // //Vector3 newPosition = charCam.ScreenToWorldPoint(Input.mousePosition) + charCam.transform.forward * (grabbedObjectSize + camDistance); // Vector3 newPosition = midpoint; // //Vector3 newPosition = eyeSight.transform.position; // grabbedObject.transform.position = newPosition; // print(newPosition); } }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { //origineye = (eyes.left.origin + eyes.right.origin) / 2;//眼球の中間の座標を求める //originvector = (FoveInterface.GetLeftEyeVector() + FoveInterface.GetRightEyeVector()) / 2;//両目のベクトルの平均を求める //origineye = eyes.right.origin;//右目の座標を求める //originvector = FoveInterface.GetRightEyeVector();//右目のベクトルの平均を求める //tunneringpos = root10 * originvector - origineye;//眼球の座標と大きさ10のベクトルでトンネリングの座標を求める tunneringpos = ((eyes.left.origin + FoveInterface.GetLeftEyeVector() * 10.0f) + (eyes.right.origin + FoveInterface.GetRightEyeVector() * 10.0f)) / 2; //tunneringpos = eyes.right.origin + FoveInterface.GetRightEyeVector() * 10.0f; transform.position = tunneringpos; //トンネリングを移動 //kyori = tunneringpos.x * tunneringpos.x + tunneringpos.y * tunneringpos.y + tunneringpos.z * tunneringpos.z; /*Debug.Log(origineye.ToString()); * Debug.Log(originvector.ToString()); * Debug.Log(tunneringpos.ToString());*/ //Debug.Log(tunneringpos.x.ToString() + ":" + tunneringpos.y.ToString() + ":" + tunneringpos.z.ToString() + ":" + kyori.ToString()); } else { originhit = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { origineye = eyes.right.origin; //右目の座標を求める originvector = FoveInterface.GetRightEyeVector(); //右目のベクトルの平均を求める tunneringpos = root10 * originvector - origineye; //眼球の座標と大きさ10のベクトルでトンネリングの座標を求める transform.position = tunneringpos; //トンネリングを移動 //kyori = tunneringpos.x * tunneringpos.x + tunneringpos.y * tunneringpos.y + tunneringpos.z * tunneringpos.z; //Debug.Log(tunneringpos.x.ToString() + ":" + tunneringpos.y.ToString() + ":" + tunneringpos.z.ToString() + ":" + kyori.ToString()); } else { originhit = eyes.right.GetPoint(3.0f); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { origineye = eyes.left.origin; //左目の座標を求める originvector = FoveInterface.GetLeftEyeVector(); //左目のベクトルの平均を求める tunneringpos = root10 * originvector - origineye; //眼球の座標と大きさ10のベクトルでトンネリングの座標を求める transform.position = tunneringpos; //トンネリングを移動 //kyori = tunneringpos.x * tunneringpos.x + tunneringpos.y * tunneringpos.y + tunneringpos.z * tunneringpos.z; //Debug.Log(tunneringpos.x.ToString() + ":" + tunneringpos.y.ToString() + ":" + tunneringpos.z.ToString() + ":" + kyori.ToString()); } else { originhit = eyes.left.GetPoint(3.0f); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; } }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; //pos = mousemove / new Vector2(Screen.width, Screen.height); switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { //transform.position = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); eyepos = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); eyepos = eyepos / new Vector2(25, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { //transform.position = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); eyepos = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2);; eyepos = eyepos / new Vector2(25, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { //transform.position = hitRight.point; eyepos = hitRight.point; eyepos = eyepos / new Vector2(25, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { //transform.position = eyes.right.GetPoint(3.0f); eyepos = eyes.right.GetPoint(3.0f); eyepos = eyepos / new Vector2(26, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { //transform.position = hitLeft.point; eyepos = hitLeft.point; eyepos = eyepos / new Vector2(25, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } else { //transform.position = eyes.left.GetPoint(3.0f); eyepos = eyes.left.GetPoint(3.0f); eyepos = eyepos / new Vector2(26, 14); //tunpos = eyepos / new Vector2(Screen.width, Screen.height); //マウスの座標をシェーダーに代入するために値を調整 //1~0で表現するためにスクリーンの大きさで割る //tunpos -= new Vector2(0.5f, 0.5f);//中心座標のずれを修正 //plane.SetFloat("_UX", tunpos.x);//マウスのx座標をシェーダーのx座標に代入 //plane.SetFloat("_VY", tunpos.y);//マウスのy座標をシェーダーのx座標に代入 plane.SetFloat("_UX", eyepos.x); //マウスのx座標をシェーダーのx座標に代入 plane.SetFloat("_VY", eyepos.y); //マウスのy座標をシェーダーのx座標に代入 } break; } //Debug.Log("Eyepos" + eyepos); //Debug.Log("Tunpos" + tunpos); //Debug.Log("Pos(" + pos.x + "," + pos.y + ")"); }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) { case Fove.EFVR_Eye.Neither: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { originhit = hitLeft.point + ((hitRight.point - hitLeft.point) / 2); //視点座標を代入 //眼球の中心座標を求める //視点の座標から眼球の中心座標を引いて、眼球から視点までのベクトルを求める origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); //√計算 origindirection3 = Mathf.Sqrt(origindirection2); //√計算 newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //長さ10のベクトルに変換 //眼球の座標にトンネリングまでの座標を足す transform.position = newtunnering; //トンネリングを移動 kyori = newtunnering.x * newtunnering.x + newtunnering.y * newtunnering.y + newtunnering.z * newtunnering.z; Debug.Log(kyori.ToString()); } else { originhit = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; case Fove.EFVR_Eye.Left: Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); if (hitRight.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { originhit = hitRight.point; //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } else { originhit = eyes.right.GetPoint(3.0f); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; case Fove.EFVR_Eye.Right: Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); if (hitLeft.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { originhit = hitLeft.point; //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } else { originhit = eyes.left.GetPoint(3.0f); //視点を代入 origindirection = originhit.x * originhit.x + originhit.y * originhit.y + originhit.z * originhit.z; //距離の2乗を計算 origindirection2 = Mathf.Sqrt(origindirection); origindirection3 = Mathf.Sqrt(origindirection2); newtunnering = new Vector3(originhit.x * root10 / origindirection3, originhit.y * root10 / origindirection3, originhit.z * root10 / origindirection3); //トンネリングの座標を計算して代入 transform.position = newtunnering; //トンネリングを移動 } break; } }
// Update is called once per frame void Update() { FoveInterface.EyeRays rays = FoveInterface.GetEyeRays(); RaycastHit hitL; RaycastHit hitR; Physics.Raycast(rays.left, out hitL, Mathf.Infinity); Physics.Raycast(rays.left, out hitR, Mathf.Infinity); bool isHitL = Physics.Raycast(rays.left, out hitL, Mathf.Infinity); bool isHitR = Physics.Raycast(rays.right, out hitR, Mathf.Infinity); transform.position = hitL.point; eyeR.transform.position = hitR.point; if (hitL.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitL.point; } else { transform.position = rays.left.GetPoint(3.0f); } if (hitR.point != Vector3.zero) // Vector3 is non-nullable; comparing to null is always false { transform.position = hitR.point; } else { transform.position = rays.right.GetPoint(3.0f); } if (Input.GetKeyDown(KeyCode.Space)) { ShootableTargetLeft healthLeft = objectL.GetComponent <ShootableTargetLeft>(); ShootableTargetRight healthRight = objectR.GetComponent <ShootableTargetRight>(); if (f.transform.forward.x < 0) { startTimeL = Time.time; healthLeft.Damage(countTime); if (isHitL || isHitR) { successRate.Add(1); Debug.Log("LEFT Hit successfully"); } else { successRate.Add(0); Debug.Log("Left failed"); } } if (f.transform.forward.x > 0) { healthRight.Damage(countTime); startTimeR = Time.time; if (isHitL || isHitR) { Debug.Log("Right Hit successfully"); successRate.Add(1); } else { successRate.Add(0); Debug.Log("Right failed"); } } durationTime = System.Math.Abs(startTimeL - startTimeR); selectionTime.Add(durationTime); Debug.Log(startTimeL + "-" + startTimeR + "=" + durationTime); } }
// Update is called once per frame void Update() { FoveInterface.EyeRays eyes = FoveInterface.GetEyeRays(); RaycastHit hitLeft, hitRight; switch (FoveInterface.CheckEyesClosed()) //瞬き検知 { case Fove.EFVR_Eye.Neither: //両目が開いているとき Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); //左目のraycastの取得 Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); //右目のraycastの取得 if (hitLeft.point != Vector3.zero && hitRight.point != Vector3.zero) { eyerightdistance = eyes.right.direction * root10; //右目から見たトンネリングの座標を計算 eyerighttunnering = eyes.right.origin + eyerightdistance; //右目の座標と合わせることでトンネリングの正しい位置を出す eyeleftdistance = eyes.left.direction * root10; //右目から見たトンネリングの座標を計算 eyelefttunnering = eyes.left.origin + eyeleftdistance; //右目の座標と合わせることでトンネリングの正しい位置を出す eyetunnering = (eyerighttunnering + eyelefttunnering) / 2; //両目のトンネリング座標から、間の座標を出す transform.position = eyetunnering; //座標に移動 //Debug.Log(eyetunnering.x.ToString() + '+' + eyetunnering.y.ToString() + '+' + eyetunnering.z.ToString()); //kyori = eyetunnering.x * eyetunnering.x + eyetunnering.y * eyetunnering.y + eyetunnering.z * eyetunnering.z; //Debug.Log(kyori.ToString()); } else { transform.position = eyes.left.GetPoint(3.0f) + ((eyes.right.GetPoint(3.0f) - eyes.left.GetPoint(3.0f)) / 2); } break; case Fove.EFVR_Eye.Left: //左目が閉じているとき Physics.Raycast(eyes.right, out hitRight, Mathf.Infinity); //右目のraycastの取得 if (hitRight.point != Vector3.zero) { eyerightdistance = eyes.right.direction * root10; //右目から見たトンネリングの座標を計算 eyerighttunnering = eyes.right.origin + eyerightdistance; //右目の座標と合わせることでトンネリングの正しい位置を出す transform.position = eyerighttunnering; //指定座標に移動 //Debug.Log(eyerighttunnering.x.ToString() + '+' + eyerighttunnering.y.ToString() + '+' + eyerighttunnering.z.ToString()); } else { transform.position = eyes.right.GetPoint(3.0f); } break; case Fove.EFVR_Eye.Right: //右目閉じているとき Physics.Raycast(eyes.left, out hitLeft, Mathf.Infinity); //左目のraycastの取得 if (hitLeft.point != Vector3.zero) { eyeleftdistance = eyes.left.direction * root10; //右目から見たトンネリングの座標を計算 eyelefttunnering = eyes.left.origin + eyeleftdistance; //右目の座標と合わせることでトンネリングの正しい位置を出す transform.position = eyelefttunnering; //指定座標に移動 //Debug.Log(eyelefttunnering.x.ToString() + '+' + eyelefttunnering.y.ToString() + '+' + eyelefttunnering.z.ToString()); } else { transform.position = eyes.left.GetPoint(3.0f); } break; } }
// Update is called once per frame void Update() { /* * Vector3[] current_fove_pos = new Vector3[] {FoveInterface.GetLeftEyeVector(), FoveInterface.GetRightEyeVector(), FoveInterface.GetHMDPosition(), FoveInterface.GetHMDRotation().eulerAngles}; * string current_fove_data = ""; * for (int i = 0; i < current_fove_pos.Length; i++) * { * current_fove_data = current_fove_data + current_fove_pos[i].x + "," + current_fove_pos[i].y + "," + current_fove_pos[i].z + "|"; * } * WriteFrameData(current_fove_data); */ Ray left_ray = FoveInterface.GetEyeRays().left; Ray right_ray = FoveInterface.GetEyeRays().right; string current_ray_data_ld = /*"left ray direction data : " + */ left_ray.direction.x.ToString() + ", " + left_ray.direction.y.ToString() + ", " + left_ray.direction.z.ToString(); string current_ray_data_lo = /*"left ray origin data : " + */ left_ray.origin.x.ToString() + ", " + left_ray.origin.y.ToString() + ", " + left_ray.origin.z.ToString(); string current_ray_data_rd = /*"right ray direction data : " + */ right_ray.direction.x.ToString() + ", " + right_ray.direction.y.ToString() + ", " + right_ray.direction.z.ToString(); string current_ray_data_ro = /*"right ray origin data : " + */ right_ray.origin.x.ToString() + ", " + right_ray.origin.y.ToString() + ", " + right_ray.origin.z.ToString(); sum_data = current_ray_data_ld + "," + current_ray_data_lo + "," + current_ray_data_rd + "," + current_ray_data_ro; //WriteFrameData(sum_data); /* * WriteFrameData(current_ray_data_ld); * WriteFrameData(current_ray_data_lo); * WriteFrameData(current_ray_data_rd); * WriteFrameData(current_ray_data_ro); */ rayCasting(right_ray); WriteFrameData(sum_data); /* * * if (Input.GetMouseButtonUp(0)) * { * // Ray 객체 생성 * Ray ray = MainCamera.ScreenPointToRay(Input.mousePosition); * * * // rayCasting 실행 * rayCasting(ray); * * WriteFrameData(ray.ToString()); * } * * //DebugPr(FoveInterface.GetLeftEyeVector().x + ", " + FoveInterface.GetLeftEyeVector().y + ", " + FoveInterface.GetLeftEyeVector().z); * if (Input.GetKeyDown(KeyCode.Backslash)) * { * if (startPress == false && endPress == true) * { * startPos = new Vector3[] {FoveInterface.GetLeftEyeVector(), FoveInterface.GetRightEyeVector(), * FoveInterface.GetHMDPosition(), FoveInterface.GetHMDRotation().eulerAngles}; * DebugPr("backslash Key Pressed " + "startPos Length is " + startPos.Length); * startPress = true; * endPress = false; * } * * } * * if (Input.GetKeyDown(KeyCode.Slash)) * { * if (startPress == true && endPress == false) * { * endPos = new Vector3[] {FoveInterface.GetLeftEyeVector(), FoveInterface.GetRightEyeVector(), * FoveInterface.GetHMDPosition(), FoveInterface.GetHMDRotation().eulerAngles}; * DebugPr("slash Key Pressed " + "endPos Length is " + endPos.Length); * startPress = false; * endPress = true; * } * * } * * //this is a temporary condition to quit the app and write the data to the file * //using this untill i figure out what i want to do * if (Input.GetKeyDown(KeyCode.Space)) * { * DebugPr("Space Key Pressed"); * if (startPress == false && endPress == true) * { * String foveData = ""; * for (int i = 0; i < startPos.Length; i++) * { * foveData = foveData + startPos[i].x + "," + startPos[i].y + "," + startPos[i].z + "|"; * } * for (int j = 0; j < endPos.Length; j++) * { * foveData = foveData + endPos[j].x + "," + endPos[j].y + "," + endPos[j].z + "|"; * } * WriteFrameData(foveData); * } * } */ }