What Are The X and Z Locations For Save and Load

Finally figured out an equation that set the X and Z values in the filename to match how the AssetTileLoader was loading the files. The examples I saw were using Math.round(…) which did not work. The following has worked with patch size 129 and maxVisibleSize 513.



[java]

double adjustX = quad.getWorldTranslation().getX() + (patchSize - 1);

double tileX = Math.round(adjustX / ((patchSize - 1) * 2));





double adjustZ = quad.getWorldTranslation().getZ() + (patchSize - 1);

double tileZ = Math.round(adjustZ / ((patchSize - 1) * 2));



// int tileX = Math.round(cell.x * 100) / 100;

// int tileY = Math.round(cell.y * 100) / 100;

// int tileZ = Math.round(cell.z * 100) / 100;

try {

BinaryExporter.getInstance().save(quad, new File("/home/worleyc/projects/game/awakening/AwakeningEditor/assets/Scenes/Terrain/"

  • "TerrainGrid_"
  • Math.round(tileX)
  • "_"
  • 0
  • "_"
  • Math.round(tileZ)
  • ".j3o"));



    [/java]
1 Like