private void FixedUpdate() { if (!isLocalPlayer) { return; } // cam.Render(); // RenderTexture targetTexture = cam.targetTexture; // RenderTexture.active = targetTexture; // Texture2D texture2D = new Texture2D (targetTexture.width, targetTexture.height, TextureFormat.RGB24, false); // texture2D.ReadPixels (new Rect (0, 0, targetTexture.width, targetTexture.height), 0, 0); // texture2D.Apply (); // byte[] image = texture2D.EncodeToJPG (); // UnityEngine.Object.DestroyImmediate (texture2D); // CompressedImageMsg msg = new CompressedImageMsg(new HeaderMsg(0, new TimeMsg(0,0),"cam"), "jpeg", image); // ros.Publish(CompressedImageMsg.GetMessageTopic(), msg); // If holding down W or S control the car manually if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || true) { s.UpdateValues(); // s.H = 0f; // s.V = 0.2f; m_Car.Move(s.H, s.V, s.V, 0f); } else { m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f); } }
private void FixedUpdate() { // ### High level controls ### int oldControl = HighLevelControl; if (Input.GetKey(KeyCode.I)) { HighLevelControl = 0; } else if (Input.GetKey(KeyCode.J)) { HighLevelControl = 1; } else if (Input.GetKey(KeyCode.L)) { HighLevelControl = 2; } if (oldControl != HighLevelControl) { m_Car.setHighLevelControl(HighLevelControl); } s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); }
private void Update() { statistics(); updateCheckpoints(); //Bounds bbx = GetMaxBounds(mainCar); if (useExpert) { drive(); } // If holding down W or S control the car manually if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) { s.UpdateValues(); //Debug.Log("s.v " + s.V); m_Car.Move(s.H, s.V, s.V, 0f); } else { // Debug.Log("m_Car.CurrentSpeed " + m_Car.CurrentSpeed.ToString()); // Debug.Log("Acceleration " + Acceleration.ToString()); // Debug.Log("SteeringAngle " + SteeringAngle.ToString()); // adjustAcceleration(); // Debug.Log("SteeringAngle " + SteeringAngle.ToString()); if (UpdatedFlag || useExpert) { UpdatedFlag = false; m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f); } } }
private void FixedUpdate() { // ### High level controls ### int oldControl = HighLevelControl; if (Input.GetKey(KeyCode.I)) { HighLevelControl = 0; } else if (Input.GetKey(KeyCode.J)) { HighLevelControl = 1; } else if (Input.GetKey(KeyCode.L)) { HighLevelControl = 2; } if (oldControl != HighLevelControl) { m_Car.setHighLevelControl(HighLevelControl); } // If holding down W or S control the car manually if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S)) { s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); } else { m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f); } }
private void FixedUpdate() { // If holding down W or S control the car manually if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) { s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); } else { m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f); } }
private void FixedUpdate() { if (GameObject.Find("Car").transform.position.y < -2f) { crash = true; finished = false; } else { crash = false; finished = false; } // If holding down W or S control the car manually if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) { s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); } else { m_Car.Move(SteeringAngle, Acceleration, Brake, 0f); } }
private void FixedUpdate() { s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); }
public void maunal() { s.UpdateValues(); m_Car.Move(s.H, s.V, s.V, 0f); }