How to use UV mapping in 3D with 2D textures.

Godot Version

Godot 4.2 stable

Question

I am new to Godot and challenged myself to recreate Minecraft version 1.5. I’m trying to use UV mapping to get the textures because the textures in Minecraft 1.5 are in an Atlas file.
Minecraft_generatation_test

I’m wondering how to use UV mapping to get the textures of the blocks but I don’t know how.

If you’re making a minecraft clone, your blocks are created trough code, right? If you have your uv map already plotted out, you can create a packedvector2array of uvs as shown in this function: CataX/Scripts/Chunk.gd at 79848ffcd0271702672106dedb3bf953bb0d8e73 · Khaligufzel/CataX · GitHub

If you have your uv’s as part of your arrays, you can then apply it to your arraymesh like this: CataX/Scripts/Chunk.gd at 79848ffcd0271702672106dedb3bf953bb0d8e73 · Khaligufzel/CataX · GitHub

That is, if you’re using an arraymesh. There are multiple ways of doing it.