3D Game - How Do I Get the Slope Angle Under My Player?

Hi, I was wondering how to get the angle of the ground under my character. I already have a ground checker and I am able to move and jump.

I would like this information in order to calculate what the speed my skateboarding character should be while on a skateboard and also on a slope (the game has a bool set for “skating” when on a skateboard). So if you have comments on how to increase speed over time while rolling downhill, that be great also, but figuring out the angle is good enough for now.

I am still at a beginner level of coding, so please explain any technical term

Thanks!

You can Physics.Raycast (or even Collider.Raycast if you prefer) down from your player to see if it hits the ground.

If it does you can optionally get a RaycastHit object instance back, and that contains a .point where it hit as well as a .normal telling you which way the ground was tilting at the point of impact. From this you can use trig functions (probably Mathf.Atan()) to determine angle of ground.