I have this script to shoot bullets towards the mouse cursor but it always shoots it at a 45? degree angle.
Heres the script just for the shooting
I have a system to create a bullet and shoot it towards the mouse cursor but I also have an arm that its rotating around.
void pistolShooting()
{
Vector3 aimPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
aimPos.z = 0;
//Creating the bullet and shooting it
var pel = Instantiate(Bullet, pistolBulletSpawn.position, pistolBulletSpawn.rotation);
pel.GetComponent<Rigidbody2D>().AddForce(aimPos.normalized * 8000f);
//Playing the bullet noise
//Shot.Play();
//shooting and reloading
usingBulletPerMag -= 1;
}