Fire bullet at cursor problem

  miniGunAimIcon.position = Input.mousePosition;

                ray = Camera.main.ScreenPointToRay(miniGunAimIcon.position);
               
                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                    miniGun.LookAt(hit.point);
                else
                    miniGun.LookAt(ray.direction * 1000);

   obj = Instantiate(miniGunShell, miniGunMuzzle.position, miniGunMuzzle.rotation);
                    obj.GetComponent<Rigidbody>().AddForce(miniGunMuzzle.forward * miniGunForce, ForceMode.Impulse);

miniGunMuzzle pivot is align to minGun.

I dont know why bullet cannot hit where the cursor point at, bullets always hit a bit left near the location cursor point at.

Solved. Code is Ok. It’s caused by the minor misalignment between two pivots.