public void ChangeCamera3() { Camera2.SetActive(false); Camera3.SetActive(false); Camera4.SetActive(false); Camera1.SetActive(true); }
public void Redraw() { Camera1.ZBuffer.Clear(); Camera1.DrawScene(); Camera2.ZBuffer.Clear(); Camera2.DrawScene(); Camera3.ZBuffer.Clear(); Camera3.DrawScene(); Camera4.ZBuffer.Clear(); Camera4.DrawScene(); }
private void InitCamarasPosition() { Camera1.GetComponent <Transform>().position = cameraPositions[0]; Camera2.GetComponent <Transform>().position = cameraPositions[1]; Camera3.GetComponent <Transform>().position = cameraPositions[2]; Camera4.GetComponent <Transform>().position = cameraPositions[3]; Camera5.GetComponent <Transform>().position = cameraPositions[4]; Camera6.GetComponent <Transform>().position = cameraPositions[5]; Camera7.GetComponent <Transform>().position = cameraPositions[6]; Camera8.GetComponent <Transform>().position = cameraPositions[7]; Camera.GetComponent <Transform>().position = cameraPositions[8]; }
public void OnCamera1() { Canvas.transform.parent = Camera1.transform; Image.SetActive(false); Camera1.SetActive(true); Camera2.SetActive(false); Camera3.SetActive(false); Camera4.SetActive(false); Camera1button.sprite = Camera1buttonSprite[1]; Camera2button.sprite = Camera2buttonSprite[0]; Camera3button.sprite = Camera3buttonSprite[0]; Camera4button.sprite = Camera4buttonSprite[0]; }
private void handlePositionFOV(string arg0) { if (null != arg0 && "" != arg0) { Camera1.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera2.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera3.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera4.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera5.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera6.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera7.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera8.GetComponent <Camera>().fieldOfView = float.Parse(arg0); Camera.GetComponent <Camera>().fieldOfView = float.Parse(arg0); } }
// Update is called once per frame //get the position of the camera and get the position of the robot and then //create the triangle for the camera and then using the radius, test if any of the //four points of the robot are inside the triangle //Questions: size of triangle? //how do i know what direction the camera is pointing? using rotation i think, but //what does rotation give you exactly? void FixedUpdate() { //start off buy creating the triangle //checking if the area matches //camera1object = Instantiate(camera1object); //GameObject CameraObject = GameObject.Find ("Camera1"); camera1object = FindObjectOfType <Camera1>(); camera2object = FindObjectOfType <Camera2>(); camera3object = FindObjectOfType <Camera3>(); //Vector3 CameraPos; CameraPos = camera1object.transform.position + 50 * camera1object.transform.forward; CameraPosTwo = camera2object.transform.position + 50 * camera1object.transform.forward; CameraPosThree = camera3object.transform.position + 50 * camera1object.transform.forward; //CameraPos[1] = y1; bb1 = transform.position + 50 * transform.up + 20 * transform.right + 25 * transform.forward; bb2 = transform.position + 50 * transform.up - 20 * transform.right + 25 * transform.forward; bb3 = transform.position + 50 * transform.up + 20 * transform.right - 20 * transform.forward; bb4 = transform.position + 50 * transform.up - 20 * transform.right - 20 * transform.forward; bb5 = transform.position - 50 * transform.up + 20 * transform.right + 25 * transform.forward; bb6 = transform.position - 50 * transform.up - 20 * transform.right + 25 * transform.forward; bb7 = transform.position - 50 * transform.up + 20 * transform.right - 20 * transform.forward; bb8 = transform.position - 50 * transform.up - 20 * transform.right - 20 * transform.forward; //this is from the origin and this is NOT the right vecotr //camera1object.transform.position = CameraPos; //two = camera1object.transform.position.ToString(); //Debug.Log("We are after the CameraPos[1] and CameraPos[1] = "); //Debug.Log(two); Pos = transform.position; PosTwo = transform.position; PosThree = transform.position; PosEdit = transform.position; PosEdit[1] = PosEdit[1] + 50; //the x y and z values are floats //Debug.Log("Before"); //Debug.Log(Pos.ToString()); Pos[1] = Pos.y - CameraPos.y; Pos[0] = Pos.x - CameraPos.x; Pos[2] = Pos.z - CameraPos.z; /* * Pos1[0] = bb1.x - CameraPos.x; * Pos1[1] = bb1.y - CameraPos.y; * Pos1[2] = bb1.z - CameraPos.z; */ PosTwo[1] = PosTwo.y - CameraPosTwo.y; PosTwo[0] = PosTwo.x - CameraPosTwo.x; PosTwo[2] = PosTwo.z - CameraPosTwo.z; PosThree[1] = PosThree.y - CameraPosThree.y; PosThree[0] = PosThree.x - CameraPosThree.x; PosThree[2] = PosThree.z - CameraPosThree.z; //maybe you dont need to make the pos of the robot the same as the changed vector values //transform.position = Pos; one = Pos.ToString(); //Debug.Log("We are after the Pos[1] and pos[1] = "); //Debug.Log(one); //transform.TransformDirection(Vector3.forward) //CameraPos1 = CameraPos; //+ Vector3.up * 15; CameraPos2 = CameraPos - 100 * camera1object.transform.forward; CameraPosTwo2 = CameraPosTwo - 100 * camera2object.transform.forward; CameraPosThree3 = CameraPosThree - 100 * camera3object.transform.forward; look[0] = CameraPos2[0] - CameraPos[0]; look[1] = CameraPos2[1] - CameraPos[1]; look[2] = CameraPos2[2] - CameraPos[2]; looktwo[0] = CameraPosTwo2[0] - CameraPosTwo[0]; looktwo[1] = CameraPosTwo2[1] - CameraPosTwo[1]; looktwo[2] = CameraPosTwo2[2] - CameraPosTwo[2]; lookthree[0] = CameraPosThree3[0] - CameraPosThree[0]; lookthree[1] = CameraPosThree3[1] - CameraPosThree[1]; lookthree[2] = CameraPosThree3[2] - CameraPosThree[2]; //Physics.Raycast(camera1object.transform.position + Vector3.left + Vector3.down*15, camera1object.transform.position + Vector3.left + Vector3.down*15 + camera1object.transform.forward, 100); //Debug.DrawLine(PosEdit, transform.position + 50*Vector3.forward + 100*transform.forward, Color.yellow); Debug.DrawLine(camera1object.transform.position + 50 * camera1object.transform.forward, camera1object.transform.position - 100 * camera1object.transform.forward, Color.red); //Debug.DrawLine(camera2object.transform.position, camera2object.transform.position + 100*camera2object.transform.forward, Color.blue); //Debug.DrawLine(camera3object.transform.position, camera3object.transform.position + 100*camera3object.transform.forward, Color.yellow); Debug.DrawLine(transform.position + 50 * transform.up + 20 * transform.right + 25 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.red); Debug.DrawLine(transform.position + 50 * transform.up - 20 * transform.right + 25 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.white); Debug.DrawLine(transform.position + 50 * transform.up + 20 * transform.right - 20 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.blue); Debug.DrawLine(transform.position + 50 * transform.up - 20 * transform.right - 20 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.yellow); Debug.DrawLine(transform.position - 50 * transform.up + 20 * transform.right + 25 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.red); Debug.DrawLine(transform.position - 50 * transform.up - 20 * transform.right + 25 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.white); Debug.DrawLine(transform.position - 50 * transform.up + 20 * transform.right - 20 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.blue); Debug.DrawLine(transform.position - 50 * transform.up - 20 * transform.right - 20 * transform.forward, transform.position - 100 * transform.forward + 50 * transform.up, Color.yellow); //Debug.DrawLine(transform.position, transform.position + 100*Vector3.back, Color.white); //Debug.DrawLine(transform.position, transform.position + 100*Vector3.right, Color.blue); //Debug.DrawLine(transform.position, transform.position + 100*Vector3.left, Color.yellow); //Debug.DrawLine(camera1object.transform.position , camera1object.transform.position + Vector3.forward + 100*camera1object.transform.forward, Color.blue); //Debug.Log(CameraPos1.ToString()); //Debug.Log(CameraPos2.ToString()); angle = Vector3.Angle(look, Pos); //angle = Vector3.Angle(look, Pos1); angletwo = Vector3.Angle(looktwo, PosTwo); anglethree = Vector3.Angle(lookthree, PosThree); //Debug.Log("The angle between the two is"); //Debug.Log(angle); //Debug.Log(180-angle); if (angle <= 55) { array[0] = 1; } else { array[0] = 0; } Debug.Log("Angle is the following: "); Debug.Log(angle); if (angletwo <= 55) { array[1] = 1; } else { array[1] = 0; } //Debug.Log("Angle two is the following: "); //Debug.Log(angletwo); if (anglethree <= 55) { //Debug.Log("we are being seen by the camera"); array[2] = 1; } else { //Debug.Log("we are not being seen by the camera"); array[2] = 0; } Debug.Log("Angle three is the following: "); Debug.Log(anglethree); /* * SumArray = array[0] + array[1] + array[2]; * if (SumArray == 1) { * array[0] = 1; * if (transform.localScale.x != .75 && ctr-ctr2 == 0) { * transform.localScale += sc; * Debug.Log(transform.localScale.x); * Debug.Log("transform.localScale.x value is first"); * Debug.Log(transform.localScale.z); * Debug.Log("transform.localScale.z value is second"); * ctr += 1; * } * } * else { * array[0] = 0; * //transform.localScale.x = 1; * //transform.localScale.z = 1; * if (transform.localScale.x != 1 && ctr2 == 0) { * Debug.Log("Were in"); * transform.localScale += sc2; * Debug.Log(transform.localScale.x); * Debug.Log("transform.localScale.x value is first"); * Debug.Log(transform.localScale.z); * Debug.Log("transform.localScale.z value is second"); * ctr2 += 1; * } * } */ SumArray = array[0] + array[1] + array[2]; //2 to 3 if (SumArray == 3 && SumArrayOld == 2) { Debug.Log("SumArray is equal to 3"); rend.sharedMaterial = material[3]; transform.localScale = robotscale3; } else if (SumArray == 3 && SumArrayOld == 3) { Debug.Log("SumArray is equal to 3"); rend.sharedMaterial = material[3]; } //1 to 2 else if (SumArray == 2 && SumArrayOld == 1) { Debug.Log("SumArray is equal to 2"); rend.sharedMaterial = material[2]; transform.localScale = robotscale2; } else if (SumArray == 2 && SumArrayOld == 2) { Debug.Log("SumArray is equal to 2"); rend.sharedMaterial = material[2]; } //3 to 2 else if (SumArray == 2 && SumArrayOld == 3) { Debug.Log("SumArray is equal to 2"); rend.sharedMaterial = material[2]; transform.localScale = robotscale2; } //0 to 1 else if (SumArray == 1 && SumArrayOld == 0) { //Debug.Log("SumArray is equal to 1"); rend.sharedMaterial = material[1]; transform.localScale = robotscale1; } else if (SumArray == 1 && SumArrayOld == 1) { //Debug.Log("SumArray is equal to 1"); rend.sharedMaterial = material[1]; } //2 to 1 else if (SumArray == 1 && SumArrayOld == 2) { //Debug.Log("SumArray is equal to 1"); rend.sharedMaterial = material[1]; transform.localScale = robotscale1; } //1 to 0 else if (SumArray == 0 && SumArrayOld == 1) { Debug.Log("SumArray is equal to 0"); rend.sharedMaterial = material[0]; //transform.localScale += sc1; transform.localScale = robotscale0; } else if (SumArray == 0 && SumArrayOld == 0) { Debug.Log("SumArray is equal to 0"); rend.sharedMaterial = material[0]; } SumArrayOld = array[0] + array[1] + array[2]; //SumArray = array[0] + array[1]; //Debug.Log(SumArray); }
public void ChangeCamera1() { Camera3.SetActive(true); }