Rotating the a NavMeshAgent when going up- or downhill?

Hi.

I am trying to add a simple car to my game, which just follows waypoints on a track. Im using a NavMesh on the track and the car is an NavMeshAgent.

When going up- and downhill, the NavMeshAgent does not rotate along it’s X-axis, it remains the same.

How do I find the slope of the underlaying NavMesh and rotate the agent accordingly? Say I do a RayCast or the like from underneath the car and out to the front panel of it. How can I get information on the angle of the NavMesh underneath?

Thanks in advance.

I solved this by sampling a position on the NavMesh 0.1 units in front of the agent. Then I just used a Transform.LookAt() at that position continuously.

Don’t know how good a solution it was, but it worked.