Add force in a particular direction

my code…

public void ShootBubble()
        {
            bubble_obj_current.myRB.AddForce(myCannon.transform.forward * forceAmount , ForceMode.Impulse);
        }

this is not moving the ball in the forward direction of the cannon which I am rotating like this…

if (Input.GetMouseButton(0))
{
  Vector3 newMousePos = Input.mousePosition;
   if (newMousePos.magnitude - lastMousePos.magnitude >= 1f || newMousePos.magnitude - lastMousePos.magnitude <= -1f)
   {
      if (newMousePos.x < lastMousePos.x)
      {
         transform.eulerAngles += new Vector3(0f, -mouseRotateAmount, 0f);
      }
      else if (newMousePos.x > lastMousePos.x)
      {
         transform.eulerAngles += new Vector3(0f, mouseRotateAmount, 0f);
      }
       lastMousePos = newMousePos;
    }
    }

I have also tried to use AddRelativeForce but no change. Please help! Thanks

omg, I am so stupid. The bubble rigidbody had a contraint on the x axis position :stuck_out_tongue:

Thanks for the help though!