Firing cannons at variable angles

I’m trying to fire cannon balls at an angle from a ship.
The player will select the ‘range’ and then, based on the ‘fireLeft’ - the cannon balls will fly from the side of the ship, at the angle selected by the ‘range’.

So for example - the user selects ‘long range’, i would like the cannon balls to fly from the ship at around 40 degrees. If the user then selects close range, i would like the cannon balls to fly out from the right of the ship, without any incline. (The code currently does this).

Unfortunatly, after many many efforts - all I can get working correctly is to have them fly straight from either the left or right of the ship. I am doing this all in a coroutine. Here is my code:

IEnumerator FireCannonBall(float waitTime, int cannonIndex, bool fireLeft)
{
    yield return new WaitForSeconds(waitTime);

    Vector3 CannonPositionToUse = fireLeft ? CannonPositionsLeft[cannonIndex].position : CannonPositionsRight[cannonIndex].position;

    GameObject InstantiatedCB = Instantiate(CannonBall,
            CannonPositionToUse,
            Quaternion.identity);

    Vector3 fireDirection = fireLeft ? -transform.right : transform.right;
    InstantiatedCB.transform.LookAt(fireDirection);
    InstantiatedCB.GetComponent<Rigidbody>().velocity = fireDirection * (COMMON_CannonBallSpeed * 2); //InstantiatedCB.transform.forward * (COMMON_CannonBallSpeed / 2);
    InstantiatedCB.GetComponent<Rigidbody>().AddRelativeForce(0, 200f, 0);

    NetworkServer.Spawn(InstantiatedCB);

}

I tried using Relative force, as well as changing the velocity. I also tried using the ‘look at’ but i think my understanding of all of this isnt very good… and i cant really find anything online doing something like this.

Many thanks in advance.

Replacing ‘velocity’ with .Addforce fixed the issue.

I don’t think .AddRelativeForce can be used with .velocity.