New test: with no cloning, just adding the cubes, this time it took 5s less and uses a little less ram. This time i was able to control my character, and for my surprise, it looks like it filled all the empty space! I'll try to explain my map:
My map is made of 5 layers: The 1st one is a 50x50 cubes, which represent the floor. Then the rest have only cubes around the 50x50 square created in the 1st layer. For example (the map is seen from above): Layer 1: The rest of the layers: [1, 1, 1, 1, 1] [2, 2, 2, 2, 2] [1, 1, 1, 1, 1] [2, 0, 0, 0, 2] [1, 1, 1, 1, 1] [2, 0, 0, 0, 2] [1, 1, 1, 1, 1] [2, 0, 0, 0, 2] [1, 1, 1, 1, 1] [2, 2, 2, 2, 2] Legend: 0 - Empty tile 1 - Floor 2 - Wall And when i test, the wall cubes fill the empty area and also seem to go much farther than the actual map size. Important Note: The ground and wall tiles have different materials and i'm applying them to *the same mesh*, and they show the correct materials. *UPDATE:* Just what i thought. Now i tried apllying the floor cubes to a *floorMesh*and the wallCubes to a *wallMesh* and all works smoothly (even better fps - 25 - over the max!, just 9mb of ram and the same 9000 polys). Conclusion: Is this a bug or do i really need to create a mesh for each type of cube?
