Height of a HeightGrid point

Hello I’d like to use the getHeight() fonction for getting the height of a point in my Terrain.

I’m using TerrainGrid with infinite terrain generated by noise.

So I made this:

[java]Vector2f vec = new Vector2f();

vec.set(x, y);

for(int i=0; i < terrain.getHeightMap().length; i++)





float height = this.terrain.getHeight(vec);


Where x is the x value of the point and y is the z value for the point. And terrain is a TerrainGrid object.

but in return I get this :


Does someone know why ?

Thank you.

Is the terrain loaded and running?

Don’t do that loop btw. Get the array outside the loop and then run through it. getHeightMap() creates a new array when you call it (doesn’t just pass a reference).