private void Update() { var hits = rayCastSensors.GetHitInformations(); var output = aiModel.eval(hits.Select(hit => hit.distance).ToArray()); kartController.ApplyAcceleration(output[0]); kartController.Steer(output[1] * 2.0f - 1.0f); }
void Update() { forward = Input.GetAxis("Vertical"); turn = Input.GetAxis("Horizontal"); brake = Input.GetButton("Jump"); kart.ApplyAcceleration(forward); kart.Steer(turn); }
private void Update() { float steerAmount = Input.GetAxis("Horizontal") * steeringAngle; float powerAmount = Input.GetAxis("Vertical") * acceleration; if (powerAmount < 0.0f) { // brake controller.Brake(powerAmount * brakeFactor); } else if (powerAmount > 0.0f) { // accelerate controller.Power(powerAmount); } else { controller.Coast(); } controller.Steer(steerAmount); }