How to set position of raycast higher?

So I have this code snipped to draw a ray:

RaycastHit hit;
        Ray forward = new Ray(transform.position, transform.forward);//transform.TransformDirection(Vector3.forward) * 40;
        Debug.DrawRay(transform.position, transform.forward*40, Color.green);
        
        if(Physics.Raycast(forward, out hit, 70) && hit.collider.tag == "player")
        {
            AddReward(0.001f / 100000);
            hitDistanceGlobal = hit.distance;
            //Debug.Log("hitting Player");
        }

This ray is attached to an agent and the issue is that I want the position of the ray higher. If I use this code the ray is at the feet. At the deepest point of the agent. How can I change this?

When you create the Ray, you’re providing it with a position (transform.position) and a direction (transform.forward).

You can freely define both of these attributes of the Ray. As an example in your case:

// Apply a raw offset
Vector3 offset = new Vector3(0.0f, 1.0f, 0.0f);
Ray forward = new Ray(transform.position + offset, transform.forward);

// Attach an empty GameObject as a child to the agent and use its location
public Transform rayPos;
// ...
Ray forward = new Ray(rayPos.position, transform.forward); // or rayPos.forward