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++)
{
System.out.print(terrain.getHeightMap());
}
System.out.println(terrain.getHeightMap().toString());
float height = this.terrain.getHeight(vec);
System.out.println(String.valueOf(height));[/java]
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 :
“0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.”
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).