Unity - problem with arms rotation and flip, body flip and shotting - 2d shooter

I separated the main_body sprite from the arm sprite and made a script for body flip and another for arm rotation and flip, but now this happens:

alt text

If i make arm sprite child of main_body sprite i get this:

alt text

Here is my arm_rotation code:

public class ArmRotation : MonoBehaviour
{
    SpriteRenderer spriteRend;
    public Transform Firepoint;


    void Awake()
    {
        spriteRend = GetComponent<SpriteRenderer>();
    }

    void Update()
    {
        AimArmAtMouse();
    }

    void AimArmAtMouse()
    {
        Vector2 mousePosition = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition);   //get the mouse position as a Vector2
        Vector2 armToMouse = mousePosition - (Vector2)transform.position; //get the vector from the arm to the mouse
        float rotationZ = Vector2.SignedAngle(transform.right, armToMouse);  //calculates the angle
        transform.Rotate(0f, 0f, rotationZ);  //rotates the transform by that angle
        FlipArm(Vector2.SignedAngle(transform.right, Vector2.right)); //calls the FlipArm method and passes in the angle of the arm relative to the world
    }

    void FlipArm(float rotation)
    {
        if (rotation < -90f || rotation > 90f)
        {
            spriteRend.flipY = true;
            FlipFirePoint(true);

        }
        else
        {
            spriteRend.flipY = false;
            FlipFirePoint(false);
 
        }
    }
    void FlipFirePoint(bool flip)
    {
        var pos = Firepoint.localPosition;
        pos.y = Mathf.Abs(pos.y) * (flip ? -1 : 1);
        Firepoint.localPosition = pos;
    }

}

and my body rotation code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BodyRotation : MonoBehaviour
{


    void Update()
    {
        Flip();
    }

    void Flip() //Flips player based on mouse's position relative to it's center.
    {
        Vector3 theScale = transform.localScale;
        Vector3 pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
        float WorldXPos = Camera.main.ScreenToWorldPoint(pos).x; //Converts screen point to point in world

        if (WorldXPos > gameObject.transform.position.x)
        {
            theScale.x = 1;
            transform.localScale = theScale;
        }

        else
        {
            theScale.x = -1;
            transform.localScale = theScale;
        }

    }
}

Any sugestion on how i can fix my problem? Thank you!

fixing the first case is easier - all you need to do is adjust your player’s and arm’s sprites’ origin point so that they fit properly.

so that’s what I recommend doing.
start by adjusting the origin of the player so that when it flips around, the line which is his body, stays on the same place.

one way to achieve this would be to draw the body sprite in such a way that the body line is exactly in the center of the image, and then in unity, putting the origin in the horizontal center of the image as well.
that might be enough for a fix.