public static int GetWorldId(Vector3 position) { if (position.y < 0f || position.y > height - 1) { return(0); } int id = 0; Chunk chunk = Find(position); if (chunk != null && chunk.initialized) { Vector3 chunkPosition = chunk.transform.position; int x = Mathf.FloorToInt(position.x - chunkPosition.x); int y = Mathf.FloorToInt(position.y - chunkPosition.y); int z = Mathf.FloorToInt(position.z - chunkPosition.z); id = chunk.GetLocalId(x, y, z); } else { id = CalculateId(position); } return(id); }