i would avoid using the slope from point a to b to determine if terrain is impassable.
if you're moving directly into/at the slope (ie, perpendicular to it), it would be fine but if you approached the slope at a slight angle (almost parallel) then the difference in elevation from point a to b would be much more gradual.
instead, consider using the Normals of the terrain at point b which are static/don't change no matter your angle of approach.
using your same ray:
+ Code SnippetNX# = ABS(GetObjectRayCastNormalX( 0 ))
NZ# = ABS(GetObjectRayCastNormalZ( 0 ))
...which return values between 0.0 and 1.0 (-1.0 to 1.0 without ABS()).
now say, for example, that anything more than 45 degrees is impassable terrain:
then you could check those normals against your threshold to determine if you can move to point b:
+ Code SnippetIf NX# < MaxN# and NZ# < MaxN# then SetCameraPosition(1,cx#,cy#+10,cz#)
ie, try to keep an eye on the values of NX# & NZ#. if the terrain i'm trying to move to (point b) is impassable then the sky goes red, else green:

you could take this further and say it's impassable if you're going
up the hill but not
down it by first checking the elevation at point b and comparing it to your current elevation. IE, if
down then skip the checks and simply move there.
another usage of the normals might determine how
fast you can go up where the steeper the terrain, the slower you move.
pretty handy, eh?
i hope this helps
add: my first time implementing the theory. if i've stated anything wrong above, someone please let us know