Exemplo n.º 1
0
    void Update()
    {
        sensorInputs = sensors.GetSensorInputs();

        float steer = neuralNetwork.outputLayer.nodes[1].outputs[0];

        steer = Mathf.Clamp(steer, -1.0f, 1.0f);

        List <float> packedSensorInputs = SerializedInputData(sensorInputs, sensors.vehicleSpeed);

        neuralNetwork.Action(packedSensorInputs);
        if (vehicle.velocity < vehicle.maxVelocity)
        {
            vehicle.Accelerate(neuralNetwork.outputLayer.nodes[0].outputs[0]);
        }
        vehicle.Steer(steer * 10);
        //Debug.Log(steer);
    }