private static Mesh createFloorMesh(int meshDetail, float floorDimensions) {
        if (meshDetail < 10) {
            meshDetail = 10;
        }
        int numVertices = meshDetail * meshDetail * 2 * 3;//width * depth * two tris * 3 verts per tri

        int[] indexBuf = new int[numVertices];
        int i = 0;
        for (int x = 0; x < meshDetail; x++) {
            for (int z = 0; z < meshDetail; z++) {
                indexBuf[i] = i++;
                indexBuf[i] = i++;
                indexBuf[i] = i++;
                indexBuf[i] = i++;
                indexBuf[i] = i++;
                indexBuf[i] = i++;
            }
        }

        float[] vertBuf = new float[numVertices * 3];
        float xIncrement = floorDimensions / meshDetail;
        float zIncrement = floorDimensions / meshDetail;
        int j = 0;
        for (int x = 0; x < meshDetail; x++) {
            float xPos = x * xIncrement;
            for (int z = 0; z < meshDetail; z++) {
                float zPos = z * zIncrement;
                //First tri
                vertBuf[j++] = xPos;
                vertBuf[j++] = getY(xPos, zPos, floorDimensions);
                vertBuf[j++] = zPos;
                vertBuf[j++] = xPos;
                vertBuf[j++] = getY(xPos, zPos + zIncrement, floorDimensions);
                vertBuf[j++] = zPos + zIncrement;
                vertBuf[j++] = xPos + xIncrement;
                vertBuf[j++] = getY(xPos + xIncrement, zPos, floorDimensions);
                vertBuf[j++] = zPos;
                //Second tri
                vertBuf[j++] = xPos;
                vertBuf[j++] = getY(xPos, zPos + zIncrement, floorDimensions);
                vertBuf[j++] = zPos + zIncrement;
                vertBuf[j++] = xPos + xIncrement;
                vertBuf[j++] = getY(xPos + xIncrement, zPos + zIncrement, floorDimensions);
                vertBuf[j++] = zPos + zIncrement;
                vertBuf[j++] = xPos + xIncrement;
                vertBuf[j++] = getY(xPos + xIncrement, zPos, floorDimensions);
                vertBuf[j++] = zPos;
            }
        }

        Mesh m = new Mesh();
        m.setBuffer(VertexBuffer.Type.Index, 1, BufferUtils.createIntBuffer(indexBuf));
        m.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(vertBuf));
        m.updateBound();
        return m;
    }
Creates a curved "floor" with a MeshCollisionShape provided as the RigidBodyControl's collision shape.
Surface has four slightly concave corners to allow for multiple tests and minimize falling off the edge
of the floor.

@param assetManager for loading assets
@param floorDimensions width/depth of the "floor" (X/Z)
@param position sets the floor's local translation
@return a new Geometry
jme3-examples/src/main/java/jme3test/bullet/PhysicsTestHelper.java