How to add further rotation to transform.forward

Camera.main.transform.forward is obviously going to be 0,0,0 when you start. It also changes with the mouse and rotates though; Inevitably, this means I need to, with regards to shotguns in FPS games, add some deviation to the raycasts I’m going to be creating.

_
In the following code, I’ve discovered that while it compiles and runs, adding a Vector3 with any value to Camera.main.transform.forward and then plugging it into a Physics.Raycast(start,direction,…) function call does not actually create a raycast. Or at the least, the debug drawRay from the same point and in the same direction does not create a debug ray. If it is creating a raycast, it isn’t going to the right place.
_
How can I, with code, make a raycast call, whose direction is the Camera.main.transform.forward + a different vector’s values? While writing I think I’ve had a major realization, in that Vector3’s don’t work as rotation, but rather as position, so would I need a Quarternion? None the less I would appreciate clarification and assistance in making my shotguns in this game actually shoot with a fixed spread.

void fireCombatShotgun()
    {
        //create array of values, transform.forward + value.  iterate through a loop for this.  
        if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out RaycastHit shotgunHit, 100f))
        {
            print(shotgunHit.distance);
            Debug.DrawRay(Camera.main.transform.position, Camera.main.transform.forward, Color.blue, 6000f);
        }
        for(int i = 0; i < 7; i++)
        {
            RaycastHit hit = new RaycastHit();
            Debug.DrawRay(Camera.main.transform.position, combatShotgunAngles*, Color.blue, 6000f);*

if(Physics.Raycast(Camera.main.transform.position, combatShotgunAngles*, out hit, 100f))*
{
print(hit.distance);
}
}
//create 7 rays at origin, each having one of those x,y transform.rotaton values added to them.
}

You seem to confuse several things here. A direction vector is not a rotation. Also rotations could be represented as eulerAngles or as Quaternion. transform.forward is a unit direction vector which will never be (0,0,0) since it always has a length of exactly one unit. If the object isn’t rotated at all it will have the value (0,0,1) so it points in the positive z direction.

If you want to rotate the direction vector relatively to it’s current direction you can use a quaternion for this. Specifically

Vector3 newDir = Quaternion.Euler(0, 2.0f, 0) * transform.forward;

newDir will point in the same direction as transform.forward but rotated around the y axis by 2 degree.

If you have trouble understanding the basic concept of a vector i highly recommend the 3b1b video on vectors. If you’re generally lacking linear algebra, the whole series is worth watching ^^.