Exemplo n.º 1
0
    private void MoveAgent(float[] vectorAction)
    {
        _controller.SetInput(Mathf.Clamp(vectorAction[0] * 10, -1f, 1f));
        //RaycastHit hit, hitLeft;

        //var lft = -transform.right;
        //var rgt = transform.right;

        //if (Physics.Raycast(transform.position + new Vector3(0, Height, 0), rgt, out hit, 100, layerMask) && Physics.Raycast(transform.position + new Vector3(0, Height, 0), lft, out hitLeft, 100, layerMask))
        //{
        //    if(Mathf.Abs(hit.distance - hitLeft.distance) < 1)
        //    {
        //        AddReward(0.5f * _rb.velocity.magnitude);
        //    }
        //}
        //else
        //{
        //    Debug.Log("error");
        //}
        AddReward(0.005f * _rb.velocity.magnitude);
    }