/// <summary> /// The main entry point for the application. /// </summary> /// <remarks></remarks> public void Main() { using (BSPCollisionViewer frm = this) { if (!frm.InitializeGraphics()) { // Initialize Direct3D MessageBox.Show("Could not initialize Direct3D. This tutorial will exit."); return; } TranslationMatrix = new Matrix[coll.Vertices.Length]; for (int i = 0; i < coll.Vertices.Length; i++) { Matrix m = Matrix.Identity; m.Multiply(Matrix.Translation(coll.Vertices[i].X, coll.Vertices[i].Y, coll.Vertices[i].Z)); TranslationMatrix[i] = m; } frm.Show(); frm.Focus(); cam = new Camera2(this); // Camera(device); // While the form is still valid, render and process messages while (frm.Created) { frm.Render(); Application.DoEvents(); } } }
public void ChangeCamera3() { Camera2.SetActive(false); Camera3.SetActive(false); Camera4.SetActive(false); Camera1.SetActive(true); }
/// <summary> /// Occurs when this scene is entered /// </summary> public override void Enter() { // setup graphics resources sbGUI = new SpriteBatch(GraphicsManager.Instance.Device); sbFore = new SpriteBatch(GraphicsManager.Instance.Device); sbBack = new SpriteBatch(GraphicsManager.Instance.Device); font = Engine.Instance.Content.GetAsset <Font>(Constants.ASSET_FONT_CONSOLE); camera = new Camera2(); boardRenderer = new BoardRenderer(manager.Client, camera); unitRenderer = new UnitRenderer(boardRenderer, camera, manager.Client); camera.Translation = boardRenderer.GetTileCentre(manager.Client.GetMyUnits()[0].Location); camera.TranslationTarget = camera.Translation; // set up gui elements canvas = new Canvas(GraphicsManager.Instance.Viewport.Bounds); ConsoleForm consoleForm = new ConsoleForm(canvas); GUI_Map map = new GUI_Map(camera, manager.Client, boardRenderer, canvas); GUI_StatusBar statusBar = new GUI_StatusBar(manager.Client, this, canvas); GUI_EndTurn endTurn = new GUI_EndTurn(manager.Client, canvas); CityList = new GUI_CityList(manager.Client, this, canvas); UnitList = new GUI_UnitList(manager.Client, this, canvas); UnitActions = new GUI_UnitActions(manager.Client, this, camera, boardRenderer, canvas); CityManagment = new GUI_CityManagment(manager.Client, this, canvas); GUI_NamePlates namePlates = new GUI_NamePlates(manager.Client, canvas, camera, boardRenderer); TechTree = new GUI_Tech(manager.Client, this, canvas); GameMenu = new GUI_GameMenu(manager.Client, this, canvas); SocialPolicy = new GUI_SocialPolicy(manager.Client, this, canvas); }
/// <summary> /// The initialize graphics. /// </summary> /// <returns>The initialize graphics.</returns> /// <remarks></remarks> public bool InitializeGraphics() { // try // { render.CreateDevice(this); pc = new PortalContainer(portals, ref render.device); BSPModel.BSPDisplayedInfo.CreateVertexBuffers(ref render.device, ref bsp); BSPModel.BSPDisplayedInfo.CreateIndexBuffers(ref render.device, ref bsp); BSPModel.BSPDisplayedInfo.LoadShaderTextures(ref render.device, ref bsp); System.Drawing.Font systemfont = new System.Drawing.Font("Arial", 12f, FontStyle.Regular); text = new Font(render.device, systemfont); cam = new Camera2(this); cam.speed = 0.05f; // cam.fixedrotation = true; return(true); // } // catch (DirectXException) // { // Catch any errors and return a failure // return false; // } }
/// <summary> /// The main entry point for the application. /// </summary> /// <remarks></remarks> public void Main() { using (CollisionViewer frm = this) { if (!frm.InitializeGraphics()) { // Initialize Direct3D MessageBox.Show("Could not initialize Direct3D. This tutorial will exit."); return; } frm.Show(); frm.Focus(); cam = new Camera2(this); // Camera(device); cam.speed = 0.30f; // While the form is still valid, render and process messages while (frm.Created) { frm.Render(); frm.checkKeys(); Application.DoEvents(); } } }
public GUI_NamePlates(Client client, Canvas canvas, Camera2 camera, BoardRenderer boardRenderer) { this.client = client; this.canvas = canvas; this.camera = camera; this.boardRenderer = boardRenderer; LoadResources(); Show(); }
public GUI_UnitActions(Client client, SceneGame sceneGame, Camera2 camera, BoardRenderer boardRenderer, Canvas canvas) { this.client = client; this.sceneGame = sceneGame; this.camera = camera; this.canvas = canvas; this.boardRenderer = boardRenderer; client.SelectedUnitChnaged += Client_SelectedUnitChnaged; }
// Update is called once per frame void Update() { if (pressed == true) { GameObject go = GameObject.FindGameObjectWithTag("MainCamera"); Camera2 s = go.GetComponent <Camera2> (); s.trans(); Debug.Log("pressed"); } }
public void Redraw() { Camera1.ZBuffer.Clear(); Camera1.DrawScene(); Camera2.ZBuffer.Clear(); Camera2.DrawScene(); Camera3.ZBuffer.Clear(); Camera3.DrawScene(); Camera4.ZBuffer.Clear(); Camera4.DrawScene(); }
public GUI_Map(Camera2 camera, Client client, BoardRenderer boardRenderer, Canvas canvas) { this.camera = camera; this.boardRenderer = boardRenderer; this.client = client; this.canvas = canvas; // load resources blankTileSprite = new Sprite(boardRenderer.TileAtlas, "TILEUTIL_BLANK"); tileOutlineSprite = new Sprite(boardRenderer.TileAtlas, "TILEUTIL_OUTLINE"); Show(); }
public UnitRenderer(BoardRenderer boardRenderer, Camera2 camera, Client client) { this.client = client; this.camera = camera; playerID = client.Player.InstanceID; this.boardRenderer = boardRenderer; pathColor = Color.White; moveTargets = new List <Tile>(); // register events and load resources client.SelectedCommandChanged += Client_SelectedCommandChanged; LoadResources(); }
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]; }
private void bT_Acqure2_Click(object sender, EventArgs e) { if (!(Camera2.IsAcquring)) { Camera2.StartAcquisition(mCam2_OnFrameReceived);//委托图像接收 } else { Camera2.StopAcquisition(); } updateControls2(); }
/// <summary> /// The initialize graphics. /// </summary> /// <returns>The initialize graphics.</returns> /// <remarks></remarks> public bool InitializeGraphics() { // try // { render.CreateDevice(this); //pc = new LightmapContainer(null, ref render.device); BSPModel.BSPDisplayedInfo.CreateVertexBuffers(ref render.device, ref bsp); BSPModel.BSPDisplayedInfo.CreateIndexBuffers(ref render.device, ref bsp); BSPModel.BSPDisplayedInfo.LoadShaderTextures(ref render.device, ref bsp); BSPModel.BSPDisplayedInfo.LoadLightmapTextures(ref render.device, ref bsp); System.Drawing.Font systemfont = new System.Drawing.Font("Arial", 12f, FontStyle.Regular); text = new Font(render.device, systemfont); cam = new Camera2(this); cam.speed = 0.30f; // cam.fixedrotation = true; bspMeshes = new Mesh[bsp.BSPPermutationRawDataMetaChunks.Length]; //GraphicsStream vertexData; for (int x = 0; x < bsp.BSPPermutationRawDataMetaChunks.Length; x++) { BSPModel.BSPPermutationRawDataMetaChunk tempChunk = bsp.BSPPermutationRawDataMetaChunks[x]; // Compute the bounding box for a mesh. // VertexBufferDescription description = bsp.Display.vertexBuffer[x].Description; // vertexData = bsp.Display.vertexBuffer[x].Lock(0, 0, LockFlags.ReadOnly); /* * Geometry.ComputeBoundingBox(vertexData, * meshes[i].NumberVertices, description.VertexFormat, * out meshBoundingBoxMinValues[i], * out meshBoundingBoxMaxValues[i]); * bsp.Display.vertexBuffer[x].Unlock(); * bspMeshes[x] = new Mesh(tempChunk.FaceCount, tempChunk.VerticeCount, MeshFlags.Dynamic, bsp.Display.vertexBuffer[x], render.device); * // bspMeshes[x] = Mesh.Box(render.device, .BoundingBox.MaxX - bsp.BSPPermutationRawDataMetaChunks[x].BoundingBox.MinX, * // bsp.BSPPermutationRawDataMetaChunks[x].BoundingBox.MaxY - bsp.BSPPermutationRawDataMetaChunks[x].BoundingBox.MinY, * // bsp.BSPPermutationRawDataMetaChunks[x].BoundingBox.MaxZ - bsp.BSPPermutationRawDataMetaChunks[x].BoundingBox.MinZ); */ } return(true); // } // catch (DirectXException) // { // Catch any errors and return a failure // return false; // } }
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); } }
private void Camera1_OnCameraChanged(object sender, CameraChangedRoutedEventArgs e) { if (_isInternalChange) // Prevent infinite call or Camera1 / 2 change handlers { return; } _isInternalChange = true; Camera2.BeginInit(); Camera2.Heading = Camera1.Heading; Camera2.Attitude = Camera1.Attitude; Camera2.Distance = Camera1.Distance; Camera2.Offset = Camera1.Offset; Camera2.EndInit(); _isInternalChange = false; }
private void LoadExportedScene(string fileName) { // Now read the exported file and show in the right Viewport3D Model3D readModel3D; try { // With uncommenting the following few lines we would use Ab3d.ReaderObj from Ab3d.PowerToys to read obj files instead of Assimp //if (fileName.EndsWith(".obj", ignoreCase: true, culture: CultureInfo.InvariantCulture)) //{ // var readerObj = new Ab3d.ReaderObj(); // readModel3D = readerObj.ReadModel3D(fileName); //} //else //{ var assimpWpfImporter = new AssimpWpfImporter(); readModel3D = assimpWpfImporter.ReadModel3D(fileName); //} } catch (Exception ex) { MessageBox.Show("Error reading file:\r\n" + ex.Message); return; } var modelVisual3D = new ModelVisual3D(); modelVisual3D.Content = readModel3D; MainViewport2.Children.Clear(); MainViewport2.Children.Add(modelVisual3D); // Set Camera2 from Camera1 Camera2.TargetPosition = Camera1.TargetPosition; Camera2.Heading = Camera1.Heading; Camera2.Attitude = Camera1.Attitude; Camera2.Distance = Camera1.Distance; Camera2.Refresh(); // This will regenerate light that was cleared with MainViewport2.Children.Clear() ExportedSceneTitleTextBlock.Text = "Scene imported from " + fileName; }
private void bT_OpenCamera2_Click(object sender, EventArgs e) { if (!Camera2.IsOpen) { bool IsOpen = Camera2.OpenCamera(); if (IsOpen) { Cam2_ExpTime = Camera2.ReadExposureTime(); trackBar2.Value = (int)Cam2_ExpTime; labelExposure2.Text = String.Format("{0:N3} ms", Cam2_ExpTime / 1000); // Camera2.Set_TriggerSource(1); } } else { Camera2.CloseCamera(); } updateControls2(); }
public BoardRenderer(Client client, Camera2 camera) { this.client = client; this.camera = camera; DrawHighlight = true; DrawGrid = false; DrawResourceIcons = true; TileSize = 50; // register events client.BoardChanged += Client_BoardChanged; client.TilesUpdated += Client_TilesUpdated; // get content TileAtlas = Engine.Instance.Content.GetAsset <SpriteAtlas>("Core:XML/AtlasDefinitions/TileAtlasDefinition"); // build yield icons BuildTileIcons(); }
/// <summary> /// The initialize graphics. /// </summary> /// <returns>The initialize graphics.</returns> /// <remarks></remarks> public bool InitializeGraphics() { // try // { render.CreateDevice(this); ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref render.device, ref pm); cam = new Camera2(this); cam.speed = 0.005f; cam.Position.X = 0.5741551f; cam.Position.Y = 0.01331316f; cam.Position.Z = 0.4271703f; cam.radianv = 6.161014f; cam.radianh = 3.14159f; cam.x = 0.5741551f; cam.y = 0.01331316f; cam.z = 0.4271703f; cam.ComputePosition(); m1 = new Material(); m1.Diffuse = Color.White; m1.Ambient = Color.White; m1.Specular = Color.White; return true; // } // catch (DirectXException) // { // Catch any errors and return a failure // return false; // } }
public void InitSim(bool autoStart, bool smoothingOn, Mission mission) { gridDone = false; pathDone = false; pathSmoothDone = false; pathSearching = false; pathSearchingDone = false; autoDrive = true; run = false; isCollided = false; currentControls = new CarControls(0f, 0f, 0f); if (camera == null) { camera = new Camera2(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000f); camera.Position = new Vector3(75f, 75f, 180f); } startPose = mission.Start; goalPose = mission.Goal; HybridAStar.Epsilon = mission.AStarEpsilon; HybridAStar.GridResolution = mission.AStarGridResolution; HybridAStar.SafetyFactor = 1.5f; HybridAStar.Reset(); car = new Car(world, startPose); grid = new ObstacleGrid(world, mission.Environment); car.Body.OnCollision += new OnCollisionEventHandler(OnCollision); gridDone = false; pathDone = false; pathSearchingDone = false; bg = new Thread(() => { DateTime now = DateTime.Now; grid.BuildGVD(); console.WriteLine("GVD Generation Time: " + Math.Round((DateTime.Now - now).TotalMilliseconds) + " ms"); gridDone = true; now = DateTime.Now; pathSearching = true; astar = HybridAStar.FindPath(grid, startPose, goalPose); TimeSpan astarTime = DateTime.Now - now; poses = astar.Path; pathSearching = false; pathSearchingDone = true; if (astar.Path.Count > 0) pathDone = true; now = DateTime.Now; if (smoothingOn) smoothedPath = Smoother.Smooth(astar.Path, grid); else smoothedPath = astar.Path; TimeSpan smoothingTime = DateTime.Now - now; int numUnsafe = Smoother.UnsafeIndices != null ? Smoother.UnsafeIndices.Count : 0; console.WriteLine("A*: Total Planning Time: " + Math.Round((astarTime + smoothingTime).TotalMilliseconds) + " ms"); console.WriteLine(" Heuristic Time: " + Math.Round(astar.HeuristicInitTime.TotalMilliseconds) + " ms"); console.WriteLine(" Searching Time: " + Math.Round((astarTime - astar.HeuristicInitTime).TotalMilliseconds) + " ms"); console.WriteLine(" Smoothing Time: " + Math.Round(smoothingTime.TotalMilliseconds) + " ms (" + Smoother.NumIterations + " iterations, " + Smoother.Change + "m, " + numUnsafe + " unsafe points)"); console.WriteLine(" " + astar.Discovered.Count + " nodes discovered"); console.WriteLine(" " + astar.Expanded.Count + " nodes expanded"); controller = new StanleyFSMController(smoothedPath, goalPose); pathSmoothDone = true; if (autoStart) run = true; }); bg.IsBackground = true; bg.Priority = ThreadPriority.Lowest; bg.Start(); }
private void trackBar2_Scroll(object sender, EventArgs e) { Cam2_ExpTime = trackBar2.Value; Camera2.Set_ExposureTime(Cam2_ExpTime); labelExposure2.Text = String.Format("{0:N3} ms", Cam2_ExpTime / 1000); }
/// <summary> /// Gets the position of the mouse in world space last frame /// </summary> /// <param name="camera"></param> /// <returns></returns> public Vector2 LastMouseWorldPos(Camera2 camera) { return(camera.ConvertScreenToWorld(LastMouseScreenPos().ToVector2())); }
// Start is called before the first frame update private void Awake() { instence = this; }
public void ChangeCamera() { Camera2.SetActive(true); }
public void InitSim(bool autoStart, bool smoothingOn, Mission mission) { gridDone = false; pathDone = false; pathSmoothDone = false; pathSearching = false; pathSearchingDone = false; autoDrive = true; run = false; isCollided = false; currentControls = new CarControls(0f, 0f, 0f); if (camera == null) { camera = new Camera2(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000f); camera.Position = new Vector3(75f, 75f, 180f); } startPose = mission.Start; goalPose = mission.Goal; HybridAStar.Epsilon = mission.AStarEpsilon; HybridAStar.GridResolution = mission.AStarGridResolution; HybridAStar.SafetyFactor = 1.5f; HybridAStar.Reset(); car = new Car(world, startPose); grid = new ObstacleGrid(world, mission.Environment); car.Body.OnCollision += new OnCollisionEventHandler(OnCollision); gridDone = false; pathDone = false; pathSearchingDone = false; bg = new Thread(() => { DateTime now = DateTime.Now; grid.BuildGVD(); console.WriteLine("GVD Generation Time: " + Math.Round((DateTime.Now - now).TotalMilliseconds) + " ms"); gridDone = true; now = DateTime.Now; pathSearching = true; astar = HybridAStar.FindPath(grid, startPose, goalPose); TimeSpan astarTime = DateTime.Now - now; poses = astar.Path; pathSearching = false; pathSearchingDone = true; if (astar.Path.Count > 0) { pathDone = true; } now = DateTime.Now; if (smoothingOn) { smoothedPath = Smoother.Smooth(astar.Path, grid); } else { smoothedPath = astar.Path; } TimeSpan smoothingTime = DateTime.Now - now; int numUnsafe = Smoother.UnsafeIndices != null ? Smoother.UnsafeIndices.Count : 0; console.WriteLine("A*: Total Planning Time: " + Math.Round((astarTime + smoothingTime).TotalMilliseconds) + " ms"); console.WriteLine(" Heuristic Time: " + Math.Round(astar.HeuristicInitTime.TotalMilliseconds) + " ms"); console.WriteLine(" Searching Time: " + Math.Round((astarTime - astar.HeuristicInitTime).TotalMilliseconds) + " ms"); console.WriteLine(" Smoothing Time: " + Math.Round(smoothingTime.TotalMilliseconds) + " ms (" + Smoother.NumIterations + " iterations, " + Smoother.Change + "m, " + numUnsafe + " unsafe points)"); console.WriteLine(" " + astar.Discovered.Count + " nodes discovered"); console.WriteLine(" " + astar.Expanded.Count + " nodes expanded"); controller = new StanleyFSMController(smoothedPath, goalPose); pathSmoothDone = true; if (autoStart) { run = true; } }); bg.IsBackground = true; bg.Priority = ThreadPriority.Lowest; bg.Start(); }
// 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); }