TerrainGridTileLoader on Android not 'firing'

Sorry to post again so quickly, but this is driving me nuts (!)
I’m trying to implement a custom TerrainGridTileLoader with LOD control etc but the getTerrainQuadAt() method isn’t getting fired. (Terrain generation and management is the primary reason I’ve switch to jMonkeyEngine).

I’ve got the following code being called (once) from the update() method in my loaderAppState;
[java]
Spatial create3DGround(GlobalLocation location) {

TerrainGridTileLoader tgtl = new GpkgTerrainLoader(location);
TerrainGrid terrain = new TerrainGrid("terrain", 65, 257, tgtl);

Material mat = app.getDefaultMaterial(GraphicsEngine.MATERIAL_UNSHADED);
//mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", ColorRGBA.Green);
terrain.setMaterial(mat);

terrain.setLocalTranslation(0, 0, 0);
terrain.setLocalScale(2f, 1f, 2f);

TerrainLodControl control = new TerrainLodControl(terrain, app.getCamera());
control.setLodCalculator( new DistanceLodCalculator(65, 2.7f) ); // patch size, and a multiplier
terrain.addControl(control);

return terrain;

}
[/java]
After several attempts, the bulk of this has been copied from the TerrainGridTileLoader example. The only differences being a default material and
[java]TerrainGridTileLoader tgtl = new GpkgTerrainLoader(location);[/java]

The GpkgTerrainLoader class is;
[java]
public class GpkgTerrainLoader implements TerrainGridTileLoader {
private int patchSize;
private int quadSize;
private float heightScale = 1f;
GpkgGridFactory dtmSource = null;
float maxHeight = 1500f;
DoublePoint gridOrigin = null;

/**
 * 
 * @param dtmSource
 */
public GpkgTerrainLoader(GlobalLocation globalLocation) {
	this.dtmSource = globalLocation.getTerrainFactory();
	gridOrigin = globalLocation.getWorldGridOrigin();
	if (dtmSource==null) throw new IllegalArgumentException("DTM Package source not set");

// this.patchSize = (dtmSource.getGridRows() / 4) + 1;
// this.quadSize = dtmSource.getGridRows() + 1;
patchSize = 33;
quadSize = 129;
}

@Override
public TerrainQuad getTerrainQuadAt(Vector3f location) {

	/* Convert the cell offsets to real-world coordinates in order to
	 * query the GeoPackage for data */
	// (location x * grid size) + grid orgin = cell position in ECEF.
Log.d("GpkgTerrain", "GetTerrain at: "+location);

// Do some stuff here…

    return new TerrainQuad(
    		SceneLoaderAppState.GROUND_NAME + location, 
    		patchSize, 
    		quadSize,
    		cellHeightMap.getHeightMap()
    		);
}

[/java]
Other required methods are implemented, with the exception of read() and write()

The update() method simply contains;
[java]
if (terrain==null) {
terrain = create3DGround(currLocation);
terrain.addControl(new RigidBodyControl(0));
app.getRootNode().attachChild( terrain );
app.getPhysicsSpace().add( terrain );
}
[/java]

Any thoughts on why its not even getting to the log.d() in getTerrainQuadAt() ? Does something need initialising/ calling?
I tried to use the AssetTileLoader class provided in the example, which bizarrely does get called, but it errors on not finding the required models (which again is confusing as they are definitely included in the assets/ directory of the .apk.

I haven’t even got to the hard bit of converting from real-world DTMs yet!

thanks in advance.

TerrainGrid is a deprecated api. You are better served using “https://github.com/jayfella/TerrainWorld”.

Knowing that could have saved me 5 hours!

Do you have any more detail on TerrainWorld - Is it in dev, complete, working etc? I don’t want to whine about free code, just want to check its the best way to spend tomorrow!

Cheers.

Okay, just found this thread; http://hub.jmonkeyengine.org/forum/topic/where-to-use-callables-to-thread-procedural-terrain-generation/
which explains quite a bit.

Tomorrow’s integration experiment then…!