Determing slope direction with DOTS physics

Hello, this should be pretty easy to figure out; however, for the life of me I cannot seem to get anything to work correctly.

Problem: I’m trying to adjust the angle of the treads of my robot player on a slope. However, I cannot seem to figure out how to determine if the slope is positive of negative depending on where the character is facing. (See Image)

My Current Solution: I am able to figure out the normal from the ground collider hit and the overall angle; however, I have no clue how to get a signed value nor do I know how to do this appropriately. Here are my two code blocks that I attempted to use to solve this issue:

Bottom line objective: I’d like to adjust the treads to match the ground slope.

Any guidance or help would be greatly appreciated. Thank you!

SOLUTION

Alright, I figured it out. I was using the wrong axis when I was determining the sign of the angle. Here is my code for future folks who may run into the same problem:

    var normal = characterBody.GroundHit.Normal;
    var forward = MathUtilities.GetForwardFromRotation(rotation.Value);
    var projection = MathUtilities.ProjectOnPlane(forward, normal);
         
    var axis = MathUtilities.GetRightFromRotation(rotation.Value);

    var angle = MathHelpers.Angle(forward, projection);
    var angleSigned = MathHelpers.AngleSigned(forward, projection, axis);

Mind you, that you will need to create these helper functions (which the source code can be adapted from the Vector3 class found on Untiy’s GitHub repo.