void FixedUpdate() { if (active == false) { return; } double[] outs = agent.Brain.FeedForward(GetSensorData()); DriveCar((float)-outs[0], (float)outs[1]); /* * GetSensorData(); * float xInp = -Input.GetAxis("Horizontal"); * float yInp = Input.GetAxis("Vertical"); * DriveCar(xInp, yInp); */ agent.AddFitness(-Time.fixedDeltaTime); if (currentSpeed < 0.2f) { stableTime += Time.fixedDeltaTime; } else { stableTime = 0; } if (stableTime > 5f || agent.GetFitness() < -20) { agent.AddFitness(carManager.stopPoints); ren.material.color = carManager.stopCol; active = false; carManager.CheckGenComplete(); } }