Struggling With Raycasting Angles?

Hi All,

I’m very new to Unity and am having trouble with ray casting. Basically I have a cube that can move around the world (with a neural network behind) using:

transform.Rotate(0, output[0] * rotation, 0, Space.World); //controls the turning
transform.position += this.transform.right * output[1] * speed; //controls the movement

I am able to fire out some rays in front of the cube using this (‘i’ being a loop of 0-4):

Vector3 newVector = Quaternion.AngleAxis(i * 45 - 90, new Vector3(0, 1, 0)) * transform.right; //calculates angle of raycast
RaycastHit hit;
Ray Ray = new Ray(transform.position, newVector);
if (Physics.Raycast(Ray, out hit, 10, raycastMask)) { ...

This is fine for layers that appear directly in front of the cube (I believe therefore x = 0) however I want to angle these ray casts down a bit too (as if the cube were looking at the ground in front of itself)?

How could I go about this, would it be something like Quaternion.LookRotation?

Many Thanks in advance for your help

Anytime I use raycasts I just use Vector3.forward + Vector3.down, to get a 45 degree angle from object center to 45 degrees in front of it. But I would assume you could modify the down vector to any which vector you want. But you always need Vector3.forward as that is the calculation in worldSpace of what is the objects forward at that given time. Anything you add or subtract from that will change your angle.