Hello monkeys, i recently figured out how to implement A* pathfinding in JMonkey, but i have ran into a problem with avoiding obstacles. i want the ai to calculate a path around slopes that are too heigh for the character to climb. i have found the getheight function in terrain, but i cant figure out how to get the slope from that. does anyone know how to do this, thanks in advance!

From 8th grade algebra:

slope = rise / run

So you just need to know how far the distance is between two sampled points then you can get slope. If you can get the surface normal you can work it out also but the math is not as simple as above.

[java]

final Vector3f normal = terrain.getNormal(new Vector2f(position

.getX(), position.getZ()));

[/java]

Then calculate the angle between the normal and unit Y pretty much.