Need help rotating child of player based off of player movement.

I am trying to move a player with a sphere child representing the body. When I move the parent in one direction I want the sphere to react to that movement similar to how a RigidBody would move with force added. I am not using a RigidBody because there’s other children of the player that I want to not be affected by the force added to a RigidBody. I have it working for when you move in one plane with this code.

        if (moveDir.x > 0)
            playerSphere.transform.Rotate(0, 0, -rotateSpeed * Time.deltaTime);
        else if (moveDir.x < 0)
            playerSphere.transform.Rotate(0, 0, rotateSpeed * Time.deltaTime);
        if (moveDir.z > 0)
            playerSphere.transform.Rotate(rotateSpeed * Time.deltaTime, 0, 0);
        else if (moveDir.z < 0)
            playerSphere.transform.Rotate(-rotateSpeed * Time.deltaTime, 0, 0);

but if I start moving in the X and Z planes or diagonally I start to run into problems where the rotation is thrown off because the transform of the child is changing directions. Imgur: The magic of the Internet This is how the spin looks like right now. Any help would be appreciated.

You could use transform.RotateAround to rotate the ball around an axis that wont change (the parent). Example:

// I passed in the spheres position as the point to
// rotate around, so it won't change position,
// but only the rotation

playerSphere.transform.RotateAround( playerSphere.transform.position, -transform.forward * moveDir.x, 
        rotationSpeed * Time.deltaTime );

//and for the horizontal
playerSphere.transform.RotateAround( playerSphere.transform.position, transform.right * moveDir.z, 
        rotationSpeed * Time.deltaTime );

Good luck!