Problem with character gun on slope

I am working on a 2.5d game and have a problem, when the character walks up a slope and shoots facing the slope the bullets just get stopped by the slope.
Does anyone have any ideas for a solution that could change the angle gun based on the slope the player is going up? I have been thinking for some time now and can’t think of anything, maybe a raycast on either side of the character that detects the difference in distance between them so that it can figure out the angle or is that too over complicated? I can’t check the slopes angle because it is all one connected level.

Any Ideas?

Temp fix till we get scripts:

Pop a Vector3:


    if(Vector3.Angle(transform.forward, Vector3(0, transform.position.y, transform.position.z))){

         //Send this info the gun
         twitterUpdate = nastyAngleAbove;
    }
    
    //inside of the gun
    
    gunRotation = Quaternion.Euler(twitterUpdate, datRot, otherRot);