Get Node position

I got node on my scene. I know I can get coords (x,y,z) by [java].getWorldTranslation()[/java] etc. but is there any way to get only x and z? I just want get y manually from terrain quad.

How get Terrain Y at x,z ?

One solution is to create a downward-pointing com.jme3.math.Ray with its vertex high above the terrain
at the X and Z you’re interested in.

Create a com.jme3.collision.CollisionResults instance and use terrainQuad.collideWith(ray, results); to find
all intersections with the ray and getCollisionResults() to get the first collision.

1 Like